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

'hasOwnProperty' in javascript -

How to put a lock and transaction on table using spring 4 or above using jdbcTemplate and annotations like @Transactional? -

How to understand 2 main() functions after using uftrace to profile the C++ program? -