Monday 10 April 2017

Passing header along with res redirect without using query strings

I want to set a header after redirecting to a particular route.

app.post('/signup', (req,res) => {
    var user = new User(req.body);
    req.method = 'get';
// console.log(req.body);
    user.save().then((doc) => {
        console.log("hi");
        return user.generateAuthToken().then((token) => {
            res.header('x-auth',token);
            res.redirect('home.hbs');
        });
    })
});

I want to pass the token as a header without the use of query strings. How would it be possible?



via Ajayv

No comments:

Post a Comment