text: var express = require('express');
  var router = express.Router();
  
  /*
   * GET userlist.
   */
  router.get('/userlist', function(req, res) {
      var db = req.db;
      var collection = db.get('userlist');
      collection.find({},{},function(e,docs){
          res.json(docs);
      });
  });
  
  /*
   * POST to adduser.
   */
  router.post('/adduser', function(req, res) {
      var db = req.db;
      var collection = db.get('userlist');
      collection.insert(req.body, function(err, result){
          res.send(
              (err === null) ? { msg: '' } : { msg: err }
          );
      });
  });
  
  /*
   * DELETE to deleteuser.
   */
  router.delete('/deleteuser/:id', function(req, res) {
      var db = req.db;
      var collection = db.get('userlist');
      var userToDelete = req.params.id;
      collection.remove({ '_id' : userToDelete }, function(err) {
          res.send((err === null) ? { msg: '' } : { msg:'error: ' + err });
      });
  });
  
  /*
   * Get to getuser.
   */
  router.get('/getuser/:id', function(req, res) {
      var db = req.db;
      var collection = db.get('userlist');
      var userToGet = req.params.id;
      collection.findOne({ '_id' : userToGet }, function(err, doc) {
          res.json(doc);
      });
  });
  
  /*
   * UPDATE to updateuser
   */
  router.put('/updateuser/:id', function(req, res){
    var db = req.db;
    var collection = db.get('userlist');
    collection.update({ '_id' : req.params.id }, req.body, function(error){
      res.send(
              (err === null) ? { msg: '' } : { msg: err }
          );
    });
  })
  
  module.exports = router;
  