Tuesday 28 February 2017

Node and Express querystring woes.

Hey. I'm having an issue pulling the querystring parameters in my route.js from a http post when using a pasted url in the browser. It works perfectly when I perform the post through postman. It is as if when using the browser the get somehow strips out the querystring parameters even though I am still able to see them in the url bar.I'm using ExpressJS 4 and the ejs rendering engine.The ejs view is as follows:

verfied!

,and this is the relevant route code: app.post('/verify-email', function(req, res, next){ var foo = req.query.verif; console.log(foo); res.render('suprema'); }); app.get('/verify-email', function(req, res){ var foo = req.query; console.log(foo); res.render('verifyemail', { message: req.flash('loginMessage') }); }); I'm not just looking for an answer but want to know why this happens...

Submitted February 28, 2017 at 09:03PM by che90210

No comments:

Post a Comment