Gathering detailed insights and metrics for nestjs-redox
Gathering detailed insights and metrics for nestjs-redox
Gathering detailed insights and metrics for nestjs-redox
Gathering detailed insights and metrics for nestjs-redox
npm install nestjs-redox
Typescript
Module System
Node Version
NPM Version
Cumulative downloads
Total Downloads
Last Day
0%
NaN
Compared to previous day
Last Week
0%
NaN
Compared to previous week
Last Month
0%
NaN
Compared to previous month
Last Year
0%
NaN
Compared to previous year
3
2
This NestJS module enables to auto-generate beautiful API docs using Swagger and Redoc. It supports NestJS 11, ExpressJS and Fastify.
Using the "standalone" Option in combination with "disableGoogleFont" respects the user's privacy and allows to serve the API reference offline.
⭐️ If you like this package give it a star ;) ⭐️
nestjs-redox | NestJS | |
---|---|---|
| v11 | More information |
| v10 | More information |
npm install nestjs-redox
By default NestJSRedox automatically loads the redoc bundle from a CDN. If you want to host it yourself, install redoc via npm install redoc
and set standalone
in RedoxOptions parameter to true. An additional fix replaces the redoc logo URL with a local saved image.
See chapter "setup".
In your main.ts file, before calling app.listen() insert the module setup (Fastify example more below):
1import { NestFactory } from '@nestjs/core'; 2import { DocumentBuilder, SwaggerModule } from '@nestjs/swagger'; 3import { NestjsRedoxModule, NestJSRedoxOptions, RedocOptions } from 'nestjs-redox'; 4import { AppModule } from './app/app.module'; 5 6async function bootstrap() { 7 const app = await NestFactory.create(AppModule); 8 // ... 9 10 const swaggerConfig = new DocumentBuilder() 11 .setTitle('NESTJS-REDOX API') 12 .setDescription('some description') 13 .setVersion('1.0.0') 14 .addBearerAuth() 15 .addSecurity('roles', { 16 type: 'http', 17 scheme: 'bearer', 18 }) 19 .build(); 20 21 const redocOptions: RedocOptions = { 22 requiredPropsFirst: true, 23 logo: { 24 url: 'https://redocly.github.io/redoc/petstore-logo.png', 25 }, 26 theme: { 27 sidebar: { 28 width: '222px', 29 }, 30 }, 31 }; 32 33 const redoxOptions: NestJSRedoxOptions = { 34 useGlobalPrefix: true, 35 disableGoogleFont: true, 36 standalone: true, 37 auth: { 38 enabled: true, 39 users: { 40 test123: 'test123', 41 test: 'test', 42 }, 43 }, 44 }; 45 46 const document = SwaggerModule.createDocument(app, swaggerConfig, { 47 ignoreGlobalPrefix: false, 48 operationIdFactory: (controllerKey, methodKey) => methodKey, 49 }); 50 51 NestjsRedoxModule.setup('reference', app, document, redoxOptions, redocOptions); 52 53 // ... 54 await app.listen(port); 55} 56 57bootstrap();
1import { NestFactory } from '@nestjs/core'; 2import { FastifyAdapter, NestFastifyApplication } from '@nestjs/platform-fastify'; 3import { DocumentBuilder, SwaggerModule } from '@nestjs/swagger'; 4import { NestjsRedoxModule, NestJSRedoxOptions, RedocOptions } from 'nestjs-redox'; 5import { AppModule } from './app/app.module'; 6 7async function bootstrap() { 8 const app = await NestFactory.create<NestFastifyApplication>(AppModule, new FastifyAdapter()); 9 10 // ... 11 12 const swaggerConfig = new DocumentBuilder() 13 .setTitle('NESTJS-REDOX API') 14 .setDescription('some description') 15 .setVersion('1.0.0') 16 .addBearerAuth() 17 .addSecurity('roles', { 18 type: 'http', 19 scheme: 'bearer', 20 }) 21 .build(); 22 23 const redocOptions: RedocOptions = { 24 requiredPropsFirst: true, 25 theme: { 26 sidebar: { 27 width: '222px', 28 }, 29 }, 30 }; 31 32 const redoxOptions: NestJSRedoxOptions = { 33 useGlobalPrefix: true, 34 disableGoogleFont: true, 35 standalone: true, 36 auth: { 37 enabled: true, 38 users: { 39 test123: 'test123', 40 test: 'test', 41 }, 42 }, 43 }; 44 45 const document = SwaggerModule.createDocument(app, swaggerConfig, { 46 ignoreGlobalPrefix: false, 47 operationIdFactory: (controllerKey, methodKey) => methodKey, 48 }); 49 50 NestjsRedoxModule.setup('reference', app, document, redoxOptions, redocOptions); 51 52 //... 53 54 await app.listen(port); 55} 56 57bootstrap();
For supported options see Options.
See Changelog.
Clone this repository and run npm install
. You find the library under libs/nestjs-redox
and the demo apps under apps/demo-express
or apps/demo-fastify
. Please run npm run format
before commiting and make sure to use valid commit messages (see chapter Contributing).
Run npm run test
to run e2e tests.
If you want to contribute please create a new issue with your feature request. When your issue was approved you can work on a PR. **If you created a PR without approval and we don't see a need for the PR it won't be merged. To create a PR fork this repository and send a pull request. The commit messages must be formatted after the conventional changelog angular theme. Following scopes are allowed: "nestjs-redox", "demo-express", "demo-fastify" and "project" for changes that affect the whole project.
No vulnerabilities found.
No security vulnerabilities found.