http/middleware_spec.ts

Middleware spec type — named middleware layer definition.

Separated from http/route_spec.ts so middleware modules can import this type without creating an upward dependency on routes.

view source

Declarations
#

2 declarations

MiddlewareCarveOut
#

http/middleware_spec.ts view source

MiddlewareCarveOut import type {MiddlewareCarveOut} from '@fuzdev/fuz_app/http/middleware_spec.js';

Paths a middleware layer explicitly does not run on, and why — the named exception to a layer that covers every path by default (the origin check).

path

Hono-style pattern (/hooks/*, /health), matched like MiddlewareSpec.path.

type string

readonly

reason

Why these paths are safe without the layer — required, so a carve-out is an argument, not an omission.

type string

readonly

MiddlewareSpec
#

http/middleware_spec.ts view source

MiddlewareSpec import type {MiddlewareSpec} from '@fuzdev/fuz_app/http/middleware_spec.js';

A named middleware layer.

name

type string

path

type string

handler

type MiddlewareHandler

errors?

The error definitions this layer can answer with. Each joins the error map (resolve_route_error_map) of every route the layer runs on, beside the route's own, replacing none of them. An empty list says the layer answers with no error of its own.

type readonly RestErrorDef<number, string, SchemaEntries>[]

carve_outs?

Paths under path the layer does not run on. The handler enforces them itself (Hono mounts by path alone); the field is what keeps the generated surface from claiming the layer's errors on those routes.

type readonly MiddlewareCarveOut[]

Depends on
#

Imported by
#