This is my API route in nodejs:
router.get('/reset/:token', function(req, res) {
User.findOne({ resetPasswordToken: req.params.token, resetPasswordExpires: { $gt: Date.now() } }, function(err, user) {
if (!user) {
res.json('Password reset token is invalid or has expired.');
//return res.j('/forgot');
}
res.json('Goed');
});
});
Now when I want to test this in Postman, I use this incorrect way:
Postman Screenshot
I normally don't work with params, how can I test this?
You can use URL segment parameters like this:
URL: http://localhost:3000/reset/:id
And a URL parameter:
id
= 65bb...
2 issues.
1. In screen shot the method is POST
but your code waiting for GET
request.
2. use this url: http://localhost:3000/reset/6b...
. do not use token=
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With