Description of the task see here.
npm run start:dev
- run in development mode (usingnodemon
,ts-node
);npm run start:prod
- build a bundle (usingwebpack
) and run in production mode;npm run start:multi
- build bundle and turn on horizontal scaling for the app (usingcluster
api);npm run start:multi-dev
- the same as previous script except for building a bundle (running withnodemon
);npm run test
- run tests (usingjest
,supertest
).
There is also .env.example file in root directory with example of how should look your .env file.
If you don't create .env, port will be set 4000 by default.
{
id: string;
username: string;
age: number;
hobbies: string[];
}
-
GET
api/users
- get array of all users; -
GET
api/users/${userId}
- get object with user data by id; -
POST
api/users
- create new user (*); -
PUT
api/users/${userId}
- update user data by id (*); -
DELETE
api/users/${userId}
- delete user by id.(*) - object with username, age, hobbies must be passed in body. Unique id is assigned automatically.
- endpoint
api/users/
is considered invalid (api/users
is expected); - excess properties (all except username, age, hobbies) are ignored in POST, PUT requests;
- you must pass all required properties in POST, PUT requests, otherwise an error will be received.