Swagger Getting Started

Swagger GitHub URL for reference:

https://github.com/swagger-api/swagger-node

First, it is recommended that you have a recent node js version:

sudo npm cache clean -f sudo npm install -g n sudo n stable sudo ln -sf /usr/local/n/versions/node/6.2.0/bin/node /usr/bin/node

Installing swagger & setting up api project-

sudo npm install swagger -g

git clone https://stacksavings@bitbucket.org/stacksavings/social-app-api.git

cd social-app-api

git checkout swagger-api

npm install

to run the API:

swagger project start

to edit yaml and view api docs (on different terminal):

swagger project edit

Swagger yaml configuration- Reference Links - http://swagger.io/specification/ https://github.com/swagger-api/swagger-node/tree/master/docs

NOTES:

If you have 400 Bad request response from API in application you are working on, check in network panel of developer tolls in request headers response part. There will be information about HTTP 400 error (bad parameters or something else).

Posted on Dec 04, 2017