node-knife4j
TypeScript icon, indicating that this package has built-in type declarations

1.0.6 • Public • Published

Usage

npm install @nestjs/swagger node-knife4j swagger-ui-express express
import { SwaggerModule, DocumentBuilder } from '@nestjs/swagger'
import { knife4jSetup } from 'node-knife4j'


async function bootstrap(){
  ...
    
  const options = new DocumentBuilder()
    .setTitle('knife4j example')
    .setDescription('API description')
    .setVersion('1.0')
    .addTag('knife4j')
    .build()
  const document = SwaggerModule.createDocument(app, options)
  SwaggerModule.setup('docs', app, document)
  knife4jSetup(app, [
    {
      name: '1.x版本',
      url: `/docs-json`,
      swaggerVersion: '1.0',
      location: `/docs-json`,
    },
  ])
  await app.listen(3000)
  ...
}

此版本采用knife4j最新版:4.0.0, 解决全局设置参数默认不携带问题等。

Readme

Keywords

Package Sidebar

Install

npm i node-knife4j

Weekly Downloads

2

Version

1.0.6

License

ISC

Unpacked Size

8.68 MB

Total Files

72

Last publish

Collaborators

  • cnbrian