middleware
Introduction
Middleware is code that is run before a route. It can add things onto the req
and res
objects to pass to the main handler or simply return the request early. The idea is very similar to how Express and Koa middleware work but they are not compatible by default.
Usage
A middleware is an async function which accepts the req
, and res
objects.
To include middleware in your route, simply call the middleware
function.
Express and Koa Support
We are experimenting with adding wrappers to add partial support for Express and Koa! See this GitHub issue for more information.
Last updated