Skip to content

Latest commit

 

History

History
35 lines (25 loc) · 1.18 KB

README.md

File metadata and controls

35 lines (25 loc) · 1.18 KB

Aerobatic Swagger UI Demo

Sample project demonstrating how to bootstrap a swagger site and host it on Aerobatic. View the live demo at https://swagger-ui-demo.aerobaticapp.com/. The companion blog post goes into more detail. A simple React shell is bootstrapped using create-react-app.

Steps

  1. Download this repo and unzip
  2. Run aero create or aero create -n your-site-name from the root of the repo
  3. npm install
  4. npm run build
  5. aero deploy

Connect to swagger definition

The demo uses the sample Pet Store API. To install your own API definition, you can use one of the following 2 techniques:

  • Package the swagger JSON file in the website app bundle:

    import petStoreSwagger from "./petstore-swagger.json";
    
    SwaggerUI({
      dom_id: "#ui",
      spec: petStoreSwagger
    });
  • Download the JSON file from a remote URL:

    SwaggerUI({
      dom_id: "#ui",
      url: "http://petstore.swagger.io/v2/swagger.json"
    });