This is a swagger plugin for moleculer-web, just simple.
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
src
static
test/services
.editorconfig
.eslintrc.js
.gitignore
LICENSE
README.md
index.js
package-lock.json
package.json
prepare-swagger-ui.js

README.md

moleculer-web-swagger

npm-veriosn npm-dt

This is a swagger plugin for moleculer-web for Moleculer microservices framework, just simple.

Install

npm install moleculer-web-swagger --save

Usage

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

Todo

  • Support whitelist
  • Support security
  • Support auto read route

License

The project is available under the MIT license.