JSFiddle - React, Tailwind, and code Playground
JavaScript
//user controller
exports.postSignup = function(req, res, next) {
req.assert('email', 'Email is not valid').isEmail();
req.assert('password', 'Password must be at least 4 characters long').len(4);
req.assert('confirmPassword', 'Passwords do not match').equals(req.body.password);
var errors = req.validationErrors();
if (errors) {
req.flash('errors', errors);
return res.redirect('/signup');
}
var user = new User({
email: req.body.email,
password: req.body.password,
//Вот тут ошибка. Ругается на точку. Как сделать, чтобы фурычило, посоны?
loh.daun.debil: req.body.lohdaundebil
});
//user model
var userSchema = new mongoose.Schema({
email: { type: String, unique: true, lowercase: true },
password: String,
loh: {
daun: {
debil: { type: String, default: 'net'}
}
}
});