Package Exports
- @xmotion/nestjs-redoc
- @xmotion/nestjs-redoc/dist/index.js
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (@xmotion/nestjs-redoc) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
NestJS - Redoc
This project is a simple example of how to use Redoc with NestJS.
Installation
You can install the module using npm or yarn:
npm install @xmotion/nestjs-redocor
yarn add @xmotion/nestjs-redocHow to use
You need to install the Swagger Module first if you want to get definitions updated with your project.
In future versions you will be able to pass a URL parameter as document, but for the moment you need this document object from the swagger module
const options = new DocumentBuilder()
.setTitle('Look, i have a title')
.setDescription('A very nice description')
.setBasePath('/api/v1')
.build();
const document = SwaggerModule.createDocument(app, options);Then add the following example code.
Note: All properties are optional, if you don't specify a title we will fallback to the one you used in your DocumentBuilder instance.
const redocOptions: RedocOptions = {
title: 'Hello Nest',
logo: {
url: 'https://redocly.github.io/redoc/petstore-logo.png',
backgroundColor: '#F0F0F0',
altText: 'PetStore logo'
},
sortPropsAlphabetically: true,
hideDownloadButton: false,
hideHostname: false,
auth: {
enabled: true,
user: 'admin',
password: '123'
},
tagGroups: [
{
name: 'Core resources',
tags: ['cats'],
},
],
};
// Instead of using SwaggerModule.setup() you call this module
await RedocModule.setup('/docs', app, document, redocOptions);Contributing
Contributions are welcome! If you find any issues or have suggestions for improvement, please create an issue or submit a pull request on the GitHub repository.
License
This module is licensed under the MIT License.