This is a swagger plugin for moleculer-web for Moleculer microservices framework, just simple.
npm install moleculer-web-swagger --save
Add a service swagger.service.js
, here is all options.
const SwaggerService = require("moleculer-web-swagger");
module.exports = {
mixins: [SwaggerService],
settings: {
middleware: false,
port: 3002,
ip: "0.0.0.0",
expose: true,
swagger: {
info: {
description: "moleculer apigateway swagger",
version: "1.0.0",
title: "moleculer-apigateway",
termsOfService: "",
contact: {
name: "phantomk",
url: "https://github.com/phantomk",
email: "phantomk94@gmail.com"
},
license: {
name: "Apache 2.0",
url: "https://www.apache.org/licenses/LICENSE-2.0.html"
}
},
host: "127.0.0.1:3002",
basePath: "/v1",
tags: [{
name: "pet",
description: "Everything about your Pets",
externalDocs: {
description: "Find out more",
url: "http://swagger.io"
}
}],
schemes: [
"http",
"https"
],
consumes: [
"application/json",
"application/xml"
],
produces: [
"application/xml",
"application/json"
],
},
routes: [
// your moleculer-web routes
// you can impoert from your moleculer-web service
]
}
};
Not support middleware
- Support whitelist
- Support security
- Support auto read route
The project is available under the MIT license.