standard-middleware
v0.0.3
Published
Standard Middleware for JavaScript Servers
Readme
standard-middleware
An extension of standard-context outlining StandardMiddleware and StandardNext types to allow users to make pluggable middleware for any server framework that implements the types.
Each Middleware[] would be composed with a user defined compose function implemented to have the same functionality as koa-compose. Anything before await next() would run before subsequent middleware, anything after runs after.
For example, it would be great to be able to use all of the Hono middleware in other frameworks as well.
src/example/app.ts contains an example App class that implements the types to create a Fetch API based server. Run bun example to start the example server.
Proposed Types
Other options
Remove context
type Middleware = (req: Request, next?: Next) => Promise<Response | undefined>;