I work in node.js. I'm trying to pass data from the form to the app:
app.get('/add', function(res, req, next) { var record = new Record({ text: req.body.login, login: req.session.login }); record.save(function(err, user, affected){ res.redirect('/main', { login: req.session.login }); }); }); This error pops up:
Cannot read property 'login' of undefined.
In the form and input field everything is spelled out, name, method, etc. The most interesting thing is that I do everything the same a little earlier, everything works. Perhaps this is due to app.use(express.bodyParser()); . Although through req.query.login also does not work.