JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 163
  • Score
    100M100P100Q82906F
  • License MIT

Package Exports

  • hono-openapi-middlewares

Readme

hono-openapi-middlewares

[!NOTE] This is still work in progress.

A set of middlewares for using hono with zod-openapi:

  • authentication. Validates the claims in the security scheme in the openapi spec.
  • register components. Adds the security shemes to the openapi spec.
  • swagger-ui. Serves the swagger-ui for the openapi spec.

Installation

npm install openapi-middlewares

Authentication middleware

The authentication middleware needs to be created using the factory mehtod as it needs to have acces to the app instance.

const app = new OpenAPIHono<{
  Bindings: Bindings;
  Variables: Variables;
}>();

app.use(createAuthMiddleware(app));