expressjs optional url parameters
Solution 1:
Don't modify the name of the route at all.
app.get('/users',
will match /users
with or without a query string.
Access data in the query string via req.query
.
if (typeof req.query.limit !== 'undefined') {
// a limit has been requested
}