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:

  1. urls must unique , random individual user. decided use hash function this.
  2. urls must expire after users finish obtaining new password or after time-out period has ended.
  3. 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:

  1. what best technique scenario?
  2. 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

Popular posts from this blog

java - Run spring boot application error: Cannot instantiate interface org.springframework.context.ApplicationListener -

reactjs - React router and this.props.children - how to pass state to this.props.children -

Excel VBA "Microsoft Windows Common Controls 6.0 (SP6)" Location Changes -