I can't find an answer to this: What do I do after a new user signs up to my express.js app?
I have a view, and this in the routes/index file that correspnds:
And this signup function in my users controller:
This is in my app.js:
When I sign up a new user, I can't figure out how to redirect them. Am I going about this all wrong, or I just need to add to my controller?
I have a view, and this in the routes/index file that correspnds:
Code:
router.get('/users/firstSignIn', function(req, res, next) { res.render('uesrs/firstSignIn', { title: 'title' }); });
And this signup function in my users controller:
Code:
exports.create = function(req, res, password) { if(req.method.toLowerCase() != "post") { res.render("signup.jade", {layout: false}); } else { new user(req.body).save(); res.redirect("/users/firstSignIn"); //res.send("ok"); // USE THIS TO REDIRECT AFTER SIGNUP } }
This is in my app.js:
Code:
app.get('/users/create', users.create); app.post('/users/create', users.create);
When I sign up a new user, I can't figure out how to redirect them. Am I going about this all wrong, or I just need to add to my controller?
Comment