Skip to main content

Variable: MIDDLEWARE_ABORT_ROUTE

const MIDDLEWARE_ABORT_ROUTE: unique symbol

Defined in: packages/core/src/router/Router.ts:42

Pass this token to the next() callback in a 3-argument middleware to abort the entire routing pipeline — no further middlewares and no route handler will be executed.

Only honoured in route(). Ignored in handleError() and handleNotFound() so a misbehaving middleware cannot produce a blank page.

Example

function authMiddleware(params, locals, next) {
isAuthenticated() ? next() : next(MIDDLEWARE_ABORT_ROUTE);
}