在线时间:8:00-16:00
迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
开源软件名称:johnhof/swagger-injector开源软件地址:https://github.com/johnhof/swagger-injector开源编程语言:JavaScript 100.0%开源软件介绍:Swagger InjectorAdaptation of swagger ui to render the swagger view of a server's swagger documentation for a specified route. If you're unfamiliar with swagger, I highly recommend checking it out. KeyUsageKoaBuild for ^2.x
let Koa = require('koa');
let swagger = require('swagger-injector');
let app = new Koa();
app.use(swagger.koa({
path: `${__dirname}/swagger.json`,
}));
app.listen(3000); Express
let express = require('express');
let cookieParser = require('cookie-parser');
let swagger = require('swagger-injector');
let app = express();
app.use(cookieParser()); // REQUIRED
app.use(swagger.express({
path: `${__dirname}/swagger.json`
}));
app.listen(3000); ConfigurationThe following configuration example is a copy of the default configuration {
path: './swagger.json', // Path to swagger file
swagger: false, // swagger json. If not set, it is read from the `path` file
prefix: '', // Prefix applied to all routes
assets: '/_swagger_', // Prefix for all assets, appended to prefix
route: '/swagger', // Router to serve documentation
css: false, // Path to the css OR css string
unauthorized: false, // Unauth handler
dist: '/dist', // Path to dist directory
authentication: {
sources: ['query', 'body'], // Accepted sources of auth
key: false, // Key for the auth
value: false // Value for the auth
}
} AuthorLicenseMIT |
2023-10-27
2022-08-15
2022-08-17
2022-09-23
2022-08-13
请发表评论