- Git - Download & Install Git.
- Node.js - Download & Install Node.js and the npm package manager.
git clone -b dev https://github.com/KalinkinFiz/CRUD-API
cd CRUD-API
npm install
-
Add data on
.env.template
For example:
SERVER_PORT=4000
-
Rename
.env.template
on.env
-
Running the application in the development mode (entered into the console):
npm run start:dev
If everything goes well, then a message
🚀 Server ready on SERVER_PORT
should appear in the console -
Running the application in the production mode (entered into the console):
npm run start:prod
If everything goes well, then the
build
folder should appear and the message🚀 Server ready on SERVER_PORT
should appear in the console. -
Running the application in the cluster mode (not working yet):
npm run start:multi
Attention! The server must not be running
npm run test
-
GET
'/api/users'
:- 200 - array of users
-
GET
'/api/users/:id'
:- 200 - user with id
- 400 - id is not valid uuid
- 404 - user not found
-
POST
'/api/users'
:- 201 - created user
- 400 - body request is not valid
Structure of the object to create a new user:
{ "username": "Maxim", "age": 26, "hobbies": ["TypeScript"] }
-
PUT
'/api/users/:id'
:- 200 - updated user object
- 400 - id is not valid or request body
- 404 - user not found
-
DELETE
'/api/users/:id'
:- 204 - user deleted
- 400 - id is not valid or request body
- 404 - user not found