This project starter includes everything you need to get up and running with a quick REST backend.
- MongoDB
- local Authentication and JWT Authentication
- REST api is documented with Swagger (json format)
- pre-commit/pre-push hooks for testing
- Code coverage and testing through Jest and Supertest
- Travis CI integration
- Heroku integration
setup your .env with your local dev environment.
for production setup environment variables in travis and heroku
npm install- copy
.env.exampleto.envand set your environment variables:
DATABASE_URL,TEST_DATABASE_URL: mongodb urlsPORT: defaults to8080JWT_SECRET: defaults toS3cr3t!JWT_EXPIRY: defaults to7d
- Update
.travis.ymlper instructions below (Travis CI, Heroku setup) - Add your models, routes and secure your endpoint
by passing
jwtAuthmiddleware example:app.get('/my-protected-endpoint', jwtAuth, (req, res) => {...});
- sign up for an account at the TravisCI website
- login to Travis and go to your account repositories page and switch your repo to 'on'
- install Travis CI CLI and install Heroku CLI
- Login and integrate with Heroku by running
travis loginand supply github username/password - run
travis setup heroku - run
heroku create - after your changes run
git push heroku master - run
heroku ps:scale web=1to startup dyno on server
start: default command which callsnpm run prodprod: starts server with prod configurationsdev: starts server using nodemon which watches files for updates and reloadstest: runs all unit tests with code coverage using jest