var service = require('../services/user').createService();
var model = require('../models').user;

exports.createRoute = function(app) {

	app.get('/users', function(req, res) {
		service.list(function(err, data) {
			res.json(data);
		});
	});

	app.get('/users/toLogin', function(req, res) {
		res.render('login');
	});

	app.get('/users/toReg', function(req, res){
		res.render('reg');
	});

	app.post('/users/login', function(req, res){
		var username = req.body.username;
		var password = req.body.password;
		res.send("respond with a resource " + username  + password);
	});

	app.post('/users/reg', function(req, res){
		var username = req.body.username;
		var password = req.body.password;
		var password2 = req.body.password2;
		var user = new model(req.body);
		service.create(user, function(data) {
        	res.json(user);
		});
	});

	app.get('/users/open', function(req, res){
		var result = service.open();
		res.send("respond with a resource result: " + result);
	});

}
@@ -135,116 +135,8 @@
  %7B%0A%0A
-%09app.get('/users', function(req, res) %7B%0A%09%09service.list(function(err, data) %7B%0A%09%09%09res.json(data);%0A%09%09%7D);%0A%09%7D);%0A%0A
 %09app
@@ -179,16 +179,16 @@
  res) %7B%0A
+
 %09%09res.re
@@ -515,118 +515,8 @@
 s)%7B%0A
-%09%09var username = req.body.username;%0A%09%09var password = req.body.password;%0A%09%09var password2 = req.body.password2;%0A
 %09%09va
@@ -614,32 +614,33 @@
 r);%0A%09%09%7D);%0A%09%7D);%0A%0A
+%0A
 %09app.get('/users
@@ -643,13 +643,120 @@
 sers
-/open
+', function(req, res) %7B%0A%09%09service.list(function(err, data) %7B%0A%09%09%09res.json(data);%0A%09%09%7D);%0A%09%7D);%0A%0A%09app.get('/users/:id
 ', f
@@ -776,95 +776,488 @@
 res)
+ 
 %7B%0A%09%09
-var result = service.open();%0A%09%09res.send(%22respond with a resource result: %22 + result
+service.get(req.params.id, function(err, data) %7B%0A%09%09%09res.json(data);%0A%09%09%7D);%0A%09%7D);%0A%0A%09app.post('/users', function(req, res) %7B%0A%09%09var user = new model(req.body);%0A%09%09service.create(user, function(data) %7B%0A%09%09%09res.send('%E5%B7%B2%E5%A2%9E%E5%8A%A0');%0A%09%09%7D);%0A%09%7D);%0A%0A%09app.put('/users/:id', function(req, res) %7B%0A%09%09service.update(req.params.id, req.body, function(data) %7B%0A%09%09%09res.send('%E5%B7%B2%E4%BF%AE%E6%94%B9');%0A%09%09%7D);%0A%09%7D);%0A%0A%0A%09app.del('/users/:id', function(req, res)%7B%0A%09%09service.del(req.params.id, function(data) %7B%0A%09%09%09res.send('%E5%B7%B2%E5%88%A0%E9%99%A4');%0A%09%09%7D
 );%0A%09
@@ -1261,9 +1261,10 @@
 ;%0A%09%7D);%0A%0A
-
 %7D
+%0A

Update user.js