0.0.4 • Published 5 years ago

moleculer-web-swagger v0.0.4

Weekly downloads
115
License
MIT
Repository
github
Last release
5 years ago

moleculer-web-swagger

npm-veriosn npm-dt

This is a swagger plugin for moleculer-web, 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.