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

/* GET users listing. */
router.get('/', function(req, res, next) {
  res.send('respond with a resource');
});

module.exports = router;

@@ -62,113 +62,1336 @@
 ();%0A
-%0A/* GET users listing. */%0Arouter.get('/', function(req, res, next) %7B%0A  res.send('respond with a resource'
+var passport = require('passport');%0Avar User = require('../models/user');%0Avar Verify = require('./verify');%0A%0A/* GET users listing. */%0Arouter.get('/', function(req, res, next) %7B%0A  res.send('respond with a resource');%0A%7D);%0A%0Arouter.post('/register', function(req, res) %7B%0A    User.register(new User(%7B username : req.body.username %7D),%0A      req.body.password, function(err, user) %7B%0A        if (err) %7B%0A            return res.status(500).json(%7Berr: err%7D);%0A        %7D%0A        passport.authenticate('local')(req, res, function () %7B%0A            return res.status(200).json(%7Bstatus: 'Registration Successful!'%7D);%0A        %7D);%0A    %7D);%0A%7D);%0A%0Arouter.post('/login', function(req, res, next) %7B%0A  passport.authenticate('local', function(err, user, info) %7B%0A    if (err) %7B%0A      return next(err);%0A    %7D%0A    if (!user) %7B%0A      return res.status(401).json(%7B%0A        err: info%0A      %7D);%0A    %7D%0A    req.logIn(user, function(err) %7B%0A      if (err) %7B%0A        return res.status(500).json(%7B%0A          err: 'Could not log in user'%0A        %7D);%0A      %7D%0A%0A      var token = Verify.getToken(user);%0A              res.status(200).json(%7B%0A        status: 'Login successful!',%0A        success: true,%0A        token: token%0A      %7D);%0A    %7D);%0A  %7D)(req,res,next);%0A%7D);%0A%0Arouter.get('/logout', function(req, res) %7B%0A    req.logout();%0A  res.status(200).json(%7B%0A    status: 'Bye!'%0A  %7D
 );%0A%7D

update user route