GithubHelp home page GithubHelp logo

swagger-ui_custom_api's Introduction

swagger-ui_custom_api

swagger-ui container with custom API definition

Deployment

copy custom api yaml (or json) file swagger_name.yaml with swager to /api directory

build docker image using:

docker build -t swagger-ui_custom_api .

and run the container:

docker run -d -p 80:8080 swagger-ui_custom_api

-d detached mode: run containers in the background

-p 80:8080 port mapping 80 on host's machine to container's 8080 (if required change port number from 80 to selected one)

if name of api yaml file is different than swagger.yaml (default) the SWAGGER_YAML env variable should be set while the contaner is started, like below:

docker run -d -p 80:8080 -e SWAGGER_YAML=swagger_name.yaml swagger-ui_custom_api

thanks to that variable, when you access swagger via browser the selected file will be loaded as default. The file can be changed using Explore pool in website IF the file is located in app directory

if api yaml files weren't availbe in app directory while the docker image was building, docker volumes can be used to synchronize api directory between host and docker container, (use absolute path to api directory!) like below:

docker run -p 80:8080 -e SWAGGER_YAML=swagger.yaml -v /home/test/api:/usr/share/nginx/html/api swagger-ui_custom_api

Note: succesfully tested with swaggerapi/swagger-ui:v3.28.0

Remember: to tests some aplication's api via deployed swagger, the aplication needs to supports CORS operation. If not, use CORS Unblock add-on in mozilla firefox browser.

swagger-ui_custom_api's People

Contributors

mifot 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.