Converts _.postman_collection.json to an output.yaml and previews it via ReDoc Docker image
Start by going to command line and enter:
npm install
and
npm start
then export a Postman collection to postman_collection directory
The command will:
- pm2 will capture the change in the postman_collection directory, then run preview-docs.sh
- node index.js which will convert postman_collection.json file to output.yaml file
- build Docker garuda-docs-image and remove garuda-docs-container if it exists
- create Docker garuda-docs-container
- open http://localhost:4444/ with a preview. Please refresh page to see latest and greatest
To run this application on Windows 11, I needed:
-
Open Ubuntu 20.04.4 LTS and make sure you have Docker installed
sudo service docker status
- Pull the docker image
sudo docker pull redocly/redoc
- Serve remote spec by URL
sudo docker run -it --rm -p 80:80 -e SPEC_URL='http://localhost:8000/swagger.yaml' redocly/redoc
- Serve local file
sudo docker run -it --rm -p 80:80 -v /mnt/{{pwd}}/output.yaml:/usr/share/nginx/html/swagger.yaml -e SPEC_URL=swagger.yaml redocly/redoc
- Serve local file and watch for updates
sudo docker run -it --rm -p 80:80 -v /mnt/{{pwd}}/:/usr/share/nginx/html/swagger -e SPEC_URL=swagger/output.yaml redocly/redoc
- Screenshot of ReDoc image commands in Ubuntu