🌐 Web service to work with users. Designed with Node.js (http package). The service has horizontal scaling: starts multiple instances of application equal to the number of logical processor cores on the host machine with a load balancer that distributes requests across them using Round-robin algorithm.
Requirements: Node.js 18.12.1
Download or copy repository:
git clone https://github.com/AlexLevus/node-crud-api.gitInstall dependencies:
npm installRun service:
npm run start:prodService allow to work with User entity.
/api/users (GET)- retrieve all users;/api/users/:id (GET)- retrieve user by id;/api/users (POST)- create new user;/api/users/:id (PUT)- update user info;/api/users/:id (DELETE)- delete user;
[
{
"id": "8291f467-db9a-419d-b870-458c8c294aba",
"username": "Aleksandr",
"age": 23,
"hobbies": [
"football",
"bear"
]
},
{
"id": "6f8cbc02-8a8e-4368-83fe-e0fe6aa8c1db",
"username": "Petr",
"age": 34,
"hobbies": [
"photography",
"gym"
]
},
{
"id": "0fd855aa-c33d-4430-bfd3-7d8f607c420e",
"username": "Ivan",
"age": 20,
"hobbies": [
"auto",
"travelling"
]
}
]{
"id": "6f8cbc02-8a8e-4368-83fe-e0fe6aa8c1db",
"username": "Petr",
"age": 34,
"hobbies": [
"photography",
"gym"
]
}Request example:
{
"username": "semen",
"age": 100,
"hobbies": ["drink", "eat"]
}Response example:
{
"id": "6f8cbc02-8a8e-4368-83fe-e0fe6aa8c1db",
"username": "semen",
"age": 100,
"hobbies": ["drink", "eat"]
}Request example:
{
"username": "semen",
"age": 100,
"hobbies": ["drink", "eat"]
}Response example:
{
"id": "6f8cbc02-8a8e-4368-83fe-e0fe6aa8c1db",
"username": "semen",
"age": 100,
"hobbies": ["drink", "eat"]
}