var router = require('express').Router();
router.post('/singin', function (req, res, next) {
var phone = req.body.phone;
var password = req.body.password;
User.singin(phone, password, function (err, user) {
if(err) {
return next(err);
console.log(err);
}
console.log(user);
req.session.user = user._id;
res.send({});
});
});
module.exports = router;
seaman, так понятнее?