javascript - Express.js Routing wrong route -


i have 3 express.js routes

app.get('/packages/:name', (req, res) => {...}); app.get('/packages/search/', (req, res) => {...}); app.get('/packages/search/:name', (req, res) => {...}); 

the first , thrid routes working fine. second route never triggert. when browse "localhost/packages/search/" trigger first route res.params.name = "search/"

i can "if" check if "search/" don't think thats solution.

am doing wrong?

routes in express.js executed in order.

for detail node.js express route naming , ordering: how precedence determined?


Comments

Popular posts from this blog

javascript - Confirm a form & display message if form is valid with JQuery -

Retrieving ETA (estimated time of arrival) with Google Distance Matrix API and public transit as transport mode -

ionic framework - Meteor - Error: Failed to execute 'insertBefore' on 'Node' -