Reputation: 2708
If I have two routes:
app.get('/example/:param');
app.get('/example/url');
Is there a way to stop a request to https://domainname.com:3000/example/url
being treated as https://domainname.com:3000/example
with req.params.param = "url"
Or should I just change the route names?!
Upvotes: 3
Views: 624
Reputation: 5395
The simplest solution would be to reverse the order of the app.get
calls.
See also this answer for more approaches.
Upvotes: 4
Reputation: 1342
Your approach is not REST-ful and thus epxress.js will behave strangely. Change your paths so you no longer overload a path.
Upvotes: 0