请看一下下面的代码,有什么问题?
处理注册的路由
app.post('/reg', function (req, res, next) {
var user = new Blog(req.body.user).save(function (err) {
if (err) return next(err);
res.redirect('/login/' + user.email);
});
});
mongooseschemas的代码
var mongoose = require('mongoose');
var BlogSchema = new mongoose.Schema({
username: String,
emailaddress: String,
password: String
});
module.exports = BlogSchema;
创建module
var mongoose = require('mongoose');
var BlogSchema = require('../schemas/blog');
var Blog = mongoose.model('Blog', BlogSchema);
module.exports = Blog;
请叫我OOXX
9 years, 3 months ago