let express = require('express');
let router = express.Router();

let Graph = require('./../lib/graph');

/* GET Project */
router.get('/', function (req, res) {
  if (req.query.project) {
    if (req.session.username && req.session.password && req.session.teamName) {
      let graph = new Graph(req.query.project, 'http://' + req.session.username + ':' +
        req.session.password + '@' + req.session.teamName + '.jamacloud.com/rest/latest/')
        .ready.then(() => {
          res.json(graph.toJson());
        });
    }
  } else {
    res.render('graph', {
      title: 'Jama Software Capstone',
      subtitle: 'Graph',
      projects: req.session.projects ? req.session.projects : null
    });
  }
});

module.exports = router;

@@ -582,25 +582,12 @@
 Jama
- Software Capston
+Trac
 e',%0A
@@ -681,24 +681,237 @@
 null
-%0A    %7D);%0A  %7D%0A%7D);
+,%0A      itemHierarchy: null%0A    %7D);%0A  %7D%0A%7D);%0A%0Arouter.post('/update-hierarchy', function (req, res) %7B%0A  res.render('partials/hierarchy', %7B itemHierarchy: req.body %7D, (err, html) =%3E %7B%0A    res.status(200).send(html).end();%0A  %7D);%0A%7D);%0A
 %0A%0Amo

add post to update hierarchy var