📜  expressjs 招摇 yaml - Javascript 代码示例

📅  最后修改于: 2022-03-11 15:03:11.928000             🧑  作者: Mango

代码示例1
// To load your swagger specification yaml file you need to use a module able to convert 
// yaml to json; for instance yamljs.

>> npm install --save yamljs

const express = require('express');
const app = express();
const swaggerUi = require('swagger-ui-express');
const YAML = require('yamljs');
const swaggerDocument = YAML.load('./swagger.yaml');

app.use('/api-docs', swaggerUi.serve, swaggerUi.setup(swaggerDocument));