This repository allows you to rapidly develop REST API with an opinionated approach and an extremely short feedback loop that empowers a test driven methodology. It has testing and coverage built in.
git clone https://github.com/hareeqi/nodejs-api-starter.git
cd nodejs-api-starter
npm i
To start developing and adding an API end points
- Run the command
npm run testThis will make sure your tests always run on any file changes - Start writing a test case for a new route in the test folder, Upon saving you will notice the tests re-run and 404 not found appeared.
- Add your new function in the models folder and then add a new route in the routes folder.
- if you want your front-end to connect to the API for development purposes, run the command
npm run dev. It will restart the API server on each server file change. - To pass configuration the server. Add
.envand pass all the corresponding environment variables. Also look at./config/index.js
- Use VSCode
- Prettier plugin configured with auto save
- ESLint plugin
- DotEnv plugin
- ES6 Mocha Snippets
- You might need to turn off your firewall to have a real device connecting to your api
- Color Highlight plugin
- Select highlight minimap plguin