Member predicate Express :: RouteHandlerNode :: getPreviousMiddleware
Gets a route handler that immediately precedes this in the route stack.
For example:
app.use(auth);
app.get('/foo', parseForm, foo);
app.get('/bar', bar);
The previous from foo
is parseForm
, and the previous from parseForm
is auth
.
The previous from bar
is auth
.
This does not take URI patterns into account. Route handlers should be seen as a no-ops when the requested URI does not match its pattern, but it will be part of the route stack regardless. For example:
app.use('/admin', auth);
app.get('/foo, 'foo);
In this case, the previous from foo
is auth
although they do not act on the
same requests.