node.js - How can you add route to Nodejs without restarting the server? -
searching way create "forgot password" page users.
it must have following features:
- urls must unique , random individual user. decided use hash function this.
- urls must expire after users finish obtaining new password or after time-out period has ended.
- web-server cannot changed operation.
webserver : node.js 5.2.0
module : expressjs 4.13.3
in understanding, node.js
needs restart every time when add new/remove route
. currently, colleague uses nodemon
. although application, not ideal "forgot password" page due fact restarts web-server each time runs.
question:
- what best technique scenario?
- what specific keyword question?
you can add routes using path parameters in node (i assume you're using express.js, if clarify can modify answer).
in case register route this:
/api/v1/user/forgotpasswordendpoint/:unique_hash
this match things such as
/api/v1/user/forgotpasswordendpoint/12345
you can access 12345
through req.params.unique_hash
. lets treat endpoint differently based on hash, , grants access hash in code can it.
Comments
Post a Comment