A simple template for building a node restful api service
- nodejs
- express
- mongodb
- mocha
Rename src/config.example.js
file to src/config.js
. Fulfill all the necessary data in the file:
- cloudinary API login data - check this website
- local mongodb data (please see below for more details)
- remote mongodb data (check your Heroku account)
# mongodb config
# config locate in: src/config.js
mongodb: {
host: 'localhost',
database: 'example'
}
# or you can add an mongodb account for security
mongodb: {
host: 'localhost',
database: 'example',
user:'user',
password:'pwd'
}
yarn
yarn serve
yarn build
yarn test
yarn deploy
you can visualize the doc and test the api using Swagger Doc through web browser.
URL are as below
http://swagger.daguchuangyi.com/?url=http://localhost:8888/swagger.json#!