Giter Site home page Giter Site logo

vath-song99 / swagger-combined Goto Github PK

View Code? Open in Web Editor NEW

This project forked from thanhson1085/swagger-combined

0.0 0.0 0.0 2.89 MB

Combines all swagger documents in microservices

License: MIT License

Shell 0.01% JavaScript 95.81% CSS 3.96% HTML 0.19% Dockerfile 0.04%

swagger-combined's Introduction

Build Status

NPM

If you are building a microservice system and using Swagger.

This packet is able to help you combine all swagger documents to only one document.

For example, you have the swagger documents at http://service1/docs, http://service2/docs

This will help you combine all links above to only one link http://service/docs

NOTE: If you need Gulp, ES6 and somethings more, please see branch added_gulp

Installation & Run from Docker

docker run -d -p 3000:3000 thanhson1085/swagger-combined

Configuration file

See config/default.json as below:

{
    "list_url": [
        {
            "docs": "http://petstore.swagger.io/v2/swagger.json",
            "base_path": "http://petstore.swagger.io/v2",
            "route_match": ["/user*", "/pet*", "/store*"]
        }
    ],
    "info": { "title": "Example API", "version": "1.0" },
    "port": 3000
}
  • docs: swagger document links
  • base_path: Proxy Target
  • route_match: Routes for proxy

Please make note that you changed config/default.json to match all swagger document links you have

Installation & Run from Source Code

git clone https://github.com/thanhson1085/swagger-combined.git

Run:

cd swagger-combined
npm install
node index.js

Test

In the default, swagger-combined run on port 3000 and included swagger-ui. So you just run http://localhost:3000?url=http://localhost:3000/docs to see everything you need. Or you can see swagger api at http://localhost:3000/docs

Example & Demo

With config/default.json:

{
    "list_url": [
        {
            "docs": "http://petstore.swagger.io/v2/swagger.json",
            "base_path": "http://petstore.swagger.io/v2",
            "route_match": ["/user*", "/pet*", "/store*"]
        },
        {
            "docs": "https://angular-admin-seed.sonnguyen.ws/docs",
            "base_path": "https://angular-admin-seed.sonnguyen.ws",
            "route_match": ["/api/v1*"]
        }
    ],
    "info": { "title": "Example API", "version": "1.0" },
    "port": 3000
}

License (MIT)

Copyright (c) 2015 Nguyen Sy Thanh Son [email protected]

swagger-combined's People

Contributors

thanhson1085 avatar thurstonsand avatar sylwit avatar uvtrip avatar lukemcgregor avatar dependabot[bot] avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.