コンテンツにスキップ
#0808
Exec

The middleware is a file named pre.ts

Drop a file named pre.ts into a directory of exec scripts and it runs before every request that matches a script beside it; post.ts runs after. Auth checks, request logging, response shaping: written once, applied to the whole folder, in both worker and serverless mode.

There's no gateway to configure and no framework to adopt. The middleware's scope is the directory, which is also how your scripts were already organized.

On function platforms, cross-cutting behavior means an authorizer configured in one service, wrapper code pasted into every function, or a framework that owns your handlers.

The middleware is a filename, not a framework.