I am currently express router in Node.js and having a problem like below. Let's say I have two url; one is to get a user info and one is to register users to an application.
http://example.com/users/:idUser (this will give a information of a user)
http://example.com/users/registration (this will allow a user registration)
The problem I have facing is when I call registration, the router is working with idUser
; so I had to edit like user/registration
instead of users
. If I want to use as users/registration
, which kinds of work do I have to do. I am still a newbie in Node.js.
Thanks.
You need to order the routes appropriately so that the registration route comes before.