withMiddleware
此内容尚不支持你的语言。
withMiddleware(
middleware,child):Route
Defined in: src/http/Route.ts:80
Wrap every handler in child’s subtree with the given Middleware.
The middleware runs before the handler; it can short-circuit
(return without calling next()) or transform the response.
Nesting composes outside-in: withMiddleware(a, withMiddleware(b, get(h))) runs a first, then if it calls next(), b runs, and
if b calls next(), the handler h runs.
const protectedRoutes = withMiddleware( BearerTokenAuth({ tokens: [process.env.MGMT_TOKEN!] }), withMiddleware( IpAllowlist({ allow: ['10.0.0.0/8'] }), path('cluster', concat( path('down', post(handleDown)), path('leave', post(handleLeave)), )), ),);