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.
- Download this repo and unzip
- Run
aero create
oraero create -n your-site-name
from the root of the repo npm install
npm run build
aero deploy
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" });