Automatically serve Swagger ui for Api Gateway documentation

Nir Adler
2 min readSep 10, 2021

When developing serverless function over the aws cloud platform, you also creating an open api definition (swagger documentation), in order to download the file easily from the command line you can use tools like aws-cli or npm package .

Checkout this post for more details.

OK! so now what ? we have the swagger file an ugly json or yml that don’t really help us by them self, so now we need to use swagger ui, or swagger editor, to actually see and interact with our api documentations.

Again why not automate the process, so micro-swagger was born, and what we doing with micro-swagger is to connect this two steps into one elegant process, micro-swagger will download and serve the file locally for you to use and interact with.

npm i -g micro-swagger
micro-swagger start

This is basically it, the browser will pop up with the ui, fetching the api docs from AWS Api Gateway (first load is slow if you have many apis), in the list you can pick a stage, like prod, and the you will get a list of all the api in this stage, you can use the swagger ui by clicking the name to the editor by clicking the pencil icon.

--

--

Nir Adler

A self taught, full-stack JavaScript developer with a passion for creating websites, apps, services, and IOT aka connected smart devices. (niradler.com) 👍