Reputation: 9484
I am searching for a way to create a "Forgot password" page for my users.
It must have the following features:
Webserver : Node.js 5.2.0
Module : Expressjs 4.13.3
In my understanding, Node.js
needs to restart itself every time when I add a new/remove route
. Currently, my colleague uses nodemon
. Although it is a good application, it is not ideal for a "forgot password" page due to the fact that it restarts the web-server each time it runs.
Question:
Upvotes: 2
Views: 382
Reputation: 6377
Node will only need to be restarted after you change the actual code for your Forgot Password page, not every time someone clicks on Forgot Password. "Adding a route" means adding the code in your app that handles that forgot_password
link.
Upvotes: 1
Reputation: 4629
You can add routes using path parameters in Node (I assume you're using Express.js, but if you clarify I can modify this answer).
In this case you would register a route like this:
/api/v1/user/forgotPasswordEndpoint/:unique_hash
This would match things such as
/api/v1/user/forgotPasswordEndpoint/12345
You can access 12345
through req.params.unique_hash
. This lets you treat that endpoint differently based on the hash, and grants you access to the hash in your code so you can do something with it.
Upvotes: 3