A simple CRUD API server created using the core node:http
module that uses an in-memory database. Also implemended a multi-threaded mode with a load balancer that distributes incoming requests between several REST-server instances using the round-robin algorithm.
Endpoint | Description |
---|---|
GET /api/users |
Get all users |
GET /api/users/{user_id} |
Get user by id |
POST /api/users |
Create a new user |
PUT /api/users/{user_id} |
Update user by id |
DELETE /api/users/{user_id} |
Delete user by id |
You must have Node.js installed on your computer
# by SSH
git clone [email protected]:sashua/node-crud-api.git
# or HTTPS
git clone https://github.com/sashua/node-crud-api.git
cd node-crud-api
git checkout dev
npm install
echo "PORT=4000" > .env
# single-threaded mode
npm run start:prod
# multi-threaded mode with load balancer
npm run start:multi:prod
npm run test
This project was created as part of the "Node.js" course