This is a vanilla Node.js rest API created to show that it is possible to create a rest API using only vanilla Node.js. But in most cases, I would recommend you to use something like Express in a production project for productivity purposes.
This project uses lot of stuff such as:
- clone repository and go to project folder
git clone https://github.com/EduD/vanilla-node-rest-api-tdd.git
cd vanilla-node-rest-api-tdd
- Create .env and populate database:
# see .env.example to create same variables in .env
touch .env
npm run seed
- run the development server:
npm run dev
You can use insomnia to test all endpoints
# ROUTES
GET /tasks
POST /tasks
GET /task/:id
PUT /task/:id
DELETE /task/:id
# runs your application (you need config your .env with variable "PORT")
npm run dev
# Populate fake data (you need config your .env with variable "SEED_AMOUNT")
npm run seed
# run all tests
npm run test
# run all unit tests
npm run test:unit
# run all integration tests
npm run test:integration
# run code coverage
npm run test:coverage