I'm trying to make an e-mail verification system using Node.js, Express and EJS.
Currently, when a user registers, the server will generate a link, say
https://www.website.com/verify=foo/
and then sends it to their e-mail address. How do I make it so that the generated link directs to https://www.website.com/verify/
with the context foo
, and then fetch it using a POST method to /verify
, so that I can execute code with the given context?
Clicking a link usually causes a GET request. So in your server code you should listen for get
app.get('/verify', function(req, res){
res.send('foo: ' + req.query.foo);
});
Please pay attention your link should in this case contain a ?
and look like this: https://www.website.com/verify/?foo=value