Low Priority Express.js app.get('/route');

Is there a way to register an express.js app.get() call with a lower priority?

For example,

app.get('*', function(req, res) {});
app.get('/page', function(req, res) {});

Would there be a way to specify a lower priority on that first call so that it is at the bottom of the route lookup, allowing the later called path to be checked first, effectively as if the first line of code was executed after the second line of code?

I just had a quick look at Express' source code and it does not seem you can set any kind of priority when you add routes. Routes are always matched by order of creation. In your example, it will first try to match '*', then '/page'.

However, you can ask Express to resume matching after you are done:

app.get('*', function (req, res, next) {
   // run some tests on the request
   // ...

   // finally, resume matching
   next();
});