title: Reloading Json file on change
body: <p>I am using Nodejs Express.I am trying to display the list users from the database to the webpage.So I created a intermediate json file to store all user details and then use it to display in webpage.The server side code updates the json file and database on any new entries or deletions, but the data is not getting reflected in webpage. It gets reflected once i restart the server.</p>
  
  <p>Server.js</p>
  
  <pre><code>app.post('/add', function (req, res) {
  new employee({
      id    : req.body.id,
      firstName : req.body.firstName,
      lastName : req.body.lastName,
      emailId    : req.body.emailId
  }).save( function ( err, employee, count ){
      if( err ) return next( err );
  });
  var db = new json("user-list",true,false);  
  var count = db.getData('/count');
  
  //console.log(result[item].firstName)
  db.push('/user/'+count+'/firstName',req.body.firstName);
  db.push('/user/'+count+'/lastName',req.body.lastName);
  db.push('/user/'+count+'/emailId',req.body.emailId);
  db.push('/user/'+count+'/id',req.body.id)
  db.push('/count',count+1);
  db.save();
  db.reload();
  res.redirect( '/Webpage' );
  });
  </code></pre>
  
  <p>Webpage.js</p>
  
  <pre><code>var users = require('../user-list.json');
  router.get('/', function(req, res, next) {
  
  res.render('Webpage', {
      title: 'Express' ,
      user : users.user
  });
  });
  </code></pre>
  
  <p>Webpage.ejs :</p>
  
  <pre><code>&lt;% for(var item in user) { %&gt;
      &lt;tr&gt;
      &lt;td&gt;&lt;%= user[item].id %&gt;&lt;/td&gt;
      &lt;td&gt;&lt;%= user[item].firstName %&gt;&lt;/td&gt;
      &lt;td&gt;&lt;%= user[item].lastName %&gt;&lt;/td&gt;
      &lt;td&gt;&lt;%= user[item].emailId %&gt;&lt;/td&gt;
      &lt;td&gt;
      &lt;span onclick="editUser()" class="glyphicon glyphicon-edit"&gt;&lt;/span&gt;
      &lt;span onclick="deleteUser(&lt;%= user[item].id %&gt;)" class="glyphicon glyphicon-remove"&gt;&lt;/span&gt;
      &lt;/td&gt;
      &lt;/tr&gt;
  &lt;% }%&gt;
  </code></pre>
  
  <p>How can i get the data displayed in webpage if any changes have been made? I have browsed for while and found nothing that helps.</p>