Skip to content

Swagger

使用swagger-jsdocswagger-ui来生成swagger文档。

基本使用

ts
import { defineConfig } from 'asrv'

export default defineConfig({
  port: 9000,
  server: {
    api: {
      /**
       * @openapi
       * /api/hello:
       *   get:
       *     description: Welcome to swagger-jsdoc!
       *     responses:
       *       200:
       *         description: Returns a mysterious string.
       */
      '/api/hello': 'hello world',
    },
  },
})

点击打开web页面,点击swagger导航查看详情