let express = require('express');
let hierarchy = require('../lib/hierarchy');
let router = express.Router();

router.get('/', (req, res, next) => {
  hierarchy.getItemHierarchy(req.session.username, req.session.password, req.session.teamName, req.session.projectId)
    .then(allItems => {
      res.send(200).json(hierarchy.parseItemHierarchy(allItems));
 /*     res.render('hierarchy', {
        title: 'Select a Root Item (Optional) ',
        itemHierarchy: req.session.itemHierarchy
      });*/
    });
 /* req.session.save(function (err) {
    if (err) {
      // TODO Session save Error message
    } else {
      res.render('hierarchy', {
        title: 'Select a Root Item (Optional) ',
        itemHierarchy: req.session.itemHierarchy ? req.session.itemHierarchy : []
      });
    }
  });*/
});

module.exports = router;

@@ -157,29 +157,24 @@
 rchy.get
+All
 Item
-Hierarchy
+s
 (req.ses
@@ -240,23 +240,21 @@
 req.
-session
+query
 .project
 Id)%0A
@@ -253,10 +253,8 @@
 ject
-Id
 )%0A  

Use getAllItems from hierarchy module