newtang / expresso

A faster, safer, backwards compatible router alternative for Express.
MIT License
5 stars 0 forks source link

Allow more specific route to call `next()` to find less specific route. #21

Open newtang opened 3 years ago

newtang commented 3 years ago

Imagine we have two routes:

router.get('/api/user/foo', (req, res, next) => {
   next();
})

router.get('/api/user/:id', (req, res, next) => {
   //do stuff
})

If a call is made to GET /api/user/foo, the first route will be called, but not the second route. We should allow next() called from a route, to filter down to less specific routes, like static -> param, static -> regex, or param -> regex.

newtang commented 3 years ago

Should this be allowed by configuration?