open-index/open-npm huggingface dataset:
npm package: @openapi-ui/express-openapi-ui
Description: A middleware for using the OpenAPI-UI with Express
Author: rookie-luochao
Latest version: 0.1.0

# Express-OpenAPI-UI Middleware

[![Version](https://img.shields.io/npm/v/@openapi-ui/express-openapi-ui)](https://www.npmjs.com/package/@openapi-ui/express-openapi-ui)
[![Downloads](https://img.shields.io/npm/dm/@openapi-ui/express-openapi-ui)](https://www.npmjs.com/package/@openapi-ui/express-openapi-ui)

## Install

```bash
npm install @openapi-ui/express-openapi-ui

pnpm install @openapi-ui/express-openapi-ui
```

## Usage

[Set up Express](https://expressjs.com/en/starter/hello-world.html) and pass an OpenAPI/Swagger spec to the `openApiUIReference` middleware:

> The most popular way is use [`swagger-jsdoc`](https://github.com/Surnet/swagger-jsdoc) to generate an OpenAPI/Swagger file.


```ts
import { openApiUIReference } from '@openapi-ui/express-openapi-ui';
import swaggerJsdoc from "swagger-jsdoc";

const openApiSpec = swaggerJsdoc({
  definition: {
    openapi: "3.0.0",
    info: {
      title: "Hello World",
      version: "1.0",
    },
  },
  apis: ["./src/*.ts"], // files containing annotations as above
});

app.get('/openapi.json', (req, res) => {
  res.json(openApiSpec);
});

app.use(
  '/openapi',
  openApiUIReference({
    specPath: '/openapi.json',
  }),
);
```

[try example](https://github.com/openapi-ui/nodejs-openapi-ui/tree/main/examples/express-openapi-ui)

### Themes

```ts
import { openApiUIReference } from '@openapi-ui/express-openapi-ui';

app.use(
  "/openapi",
  openApiUIReference({
    specPath: "/openapi.json",
    theme: 'light', // light or dark
  }),
);
```

### Custom CDN

You can use a custom CDN ，default is `https://unpkg.com/openapi-ui-dist`.

```ts
import { openApiUIReference } from '@openapi-ui/express-openapi-ui';

app.use(
  "/openapi",
  openApiUIReference({
    specPath: "/openapi.json",
    cdn: 'https://registry.npmmirror.com/openapi-ui-dist/latest/files',
  }),
);
```
npm package: @openapi-ui/hono-openapi-ui
Description: A middleware for using the OpenAPI-UI with Hono
Author: rookie-luochao
Latest version: 0.1.0

# Hono-OpenAPI-UI Middleware

[![Version](https://img.shields.io/npm/v/@openapi-ui/hono-openapi-ui)](https://www.npmjs.com/package/@openapi-ui/hono-openapi-ui)
[![Downloads](https://img.shields.io/npm/dm/@openapi-ui/hono-openapi-ui)](https://www.npmjs.com/package/@openapi-ui/hono-openapi-ui)

## Install

```bash
npm install @openapi-ui/hono-openapi-ui

pnpm install @openapi-ui/hono-openapi-ui
```

## Usage

Set up [Zod OpenAPI Hono](https://github.com/honojs/middleware/tree/main/packages/zod-openapi) and pass an OpenAPI/Swagger spec to the `openApiUIReference` middleware:

```ts
import { openApiUIReference } from '@openapi-ui/hono-openapi-ui';

app.doc('/openapi.json', {
  info: {
    title: 'Example API',
    description: 'Example API description',
    version: '1.0.0',
  },
  openapi: '3.0.0',
});

app.use(
  '/openapi',
  openApiUIReference({
    specPath: '/openapi.json',
  }),
);
```

[try example](https://github.com/openapi-ui/nodejs-openapi-ui/tree/main/examples/hono-openapi-ui)

### Themes

```ts
import { openApiUIReference } from '@openapi-ui/hono-openapi-ui';

app.use(
  '/openapi',
  openApiUIReference({
    specPath: '/openapi.json',
    theme: 'light', // light or dark
  }),
);
```

### Custom CDN

You can use a custom CDN ，default is `https://unpkg.com/openapi-ui-dist`.

```ts
import { openApiUIReference } from '@openapi-ui/hono-openapi-ui';

app.use(
  '/openapi',
  openApiUIReference({
    specPath: "/openapi.json",
    cdn: 'https://registry.npmmirror.com/openapi-ui-dist/latest/files',
  }),
);
```
npm package: @openapi-ui/nestjs-openapi-ui
Description: A middleware for using the OpenAPI-UI with NestJS
Author: rookie-luochao
Latest version: 0.1.0

# NestJS-OpenAPI-UI Middleware

[![Version](https://img.shields.io/npm/v/@openapi-ui/nestjs-openapi-ui)](https://www.npmjs.com/package/@openapi-ui/nestjs-openapi-ui)
[![Downloads](https://img.shields.io/npm/dm/@openapi-ui/nestjs-openapi-ui)](https://www.npmjs.com/package/@openapi-ui/nestjs-openapi-ui)

## Install

```bash
npm install @openapi-ui/nestjs-openapi-ui

pnpm install @openapi-ui/nestjs-openapi-ui
```

## Usage

[Set up NestJS](https://docs.nestjs.com/first-steps) and [set up NestJS Swagger](https://docs.nestjs.com/openapi/introduction) and pass an OpenAPI/Swagger spec to the `openApiUIReference` middleware:

```ts
import { DocumentBuilder, SwaggerModule } from "@nestjs/swagger"
import { openApiUIReference } from "@openapi-ui/nestjs-openapi-ui"

const app = await NestFactory.create(AppModule)

const config = new DocumentBuilder()
  .setTitle('Cats example')
  .setDescription('The cats API description')
  .setVersion('1.0')
  .addTag('cats')
  .build()

const document = SwaggerModule.createDocument(app, config)
SwaggerModule.setup("swagger", app, document, {
		jsonDocumentUrl: "/openapi.json",
	});

app.use(
  "/openapi",
  openApiUIReference({
    specPath: "/openapi.json",
  }),
)
```

[try example](https://github.com/openapi-ui/nodejs-openapi-ui/tree/main/examples/nestjs-openapi-ui-express)

### Themes

```ts
import { openApiUIReference } from '@openapi-ui/nestjs-openapi-ui'

app.use(
  "/openapi",
  openApiUIReference({
    specPath: "/openapi.json",
    theme: 'light', // light or dark
  }),
)
```

### Custom CDN

You can use a custom CDN ，default is `https://unpkg.com/openapi-ui-dist`.

```ts
import { openApiUIReference } from '@openapi-ui/nestjs-openapi-ui'

app.use(
  "/openapi",
  openApiUIReference({
    specPath: "/openapi.json",
    cdn: 'https://registry.npmmirror.com/openapi-ui-dist/latest/files',
  }),
)
```