Demo Node JS Express framework by using Swagger and bluebird
Node JS most famous framework isExpress. Many developer recommends express framework to write the back-end code. People are using express because it is customizable backend scripting language, code can be written in pure js (ES5 or ES6), now today's world we can also write back-end code by using typescript.
In this demo we will use swagger routes with middlewares. It makes our API documentation much more attractive and understandable. So any one back-end developer can understand, what's going on.
Requirment
Mongodb 3.6+:
- Install MonngDB 3.6
Ref:https://docs.mongodb.com/manual/installation/
NodeJS v8+
Ref:Learn Node- Framework: Learn Express
Run Locally with Node
- Clone the project:
https://github.com/radhey113/node-express-latest-swagger-bluebird- Go to project working directory / Project folder
- Execute command
npm install - After that Run Command
npm start - Open
http://localhost:2201to check that your server is running or not. - To check the documentation Kindly follow the:
http://localhost:2201/document
Run Project with Dockerfile
- Install Docker
https://docs.docker.com/install/
- Go to terminal, Run command
cd <Project directory path>
- Run command to create node project build
docker build -t node:8 ./
- To Run node server (Local 2201 port mapping node server 2202 port from container)
docker run -p 2202:2201 node:8
- To Run node server in deamon mode use command
<Parameter -d>docker run -p 2202:2201 -d node:8
- Open
http://localhost:2202to check that your server is running or not. - To check the documentation Kindly follow the:
http://localhost:2202/document
Set environment variable
- No need to set custom environment variable, if you want to set any environment variable just add it to
.envfile. - There is a
npm modulecalleddotenvwill configure environment variable from.envto our system..envis the default environment file which will automatically configured by thedotenv; - You need to require
dotenvon the to of the index.js file - i.e
require('dotenv').config()
I hope it will help you to create your new nodejs project with express using swagger api documentation.

Formed in 2009, the Archive Team (not to be confused with the archive.org Archive-It Team) is a rogue archivist collective dedicated to saving copies of rapidly dying or deleted websites for the sake of history and digital heritage. The group is 100% composed of volunteers and interested parties, and has expanded into a large amount of related projects for saving online and digital history.

