- Git - Download & Install Git.
- Node.js - Download & Install Node.js and the npm package manager.
git clone https://github.com/h4cktivist/nodejs2024Q1-service.git
npm install
In the root directory create a file named .env and declare the PORT variable there. For example:
PORT=4000
Then use:
npm start
The server will run on http://localhost:PORT
GET /user- get all usersGET /user/:id- get single user byidPOST /user- create user. Body is required:{ "login": string, "password": string }PUT /user/:id- update user's password. Body is required:{ "oldPassword": string, "newPassword": string }DELETE /user/:id- delete user
GET /artist- get all artistsGET /artist/:id- get single artist byidPOST /artist- create artist. Body is required:{ "login": string, "grammy": boolean }PUT /artist/:id- update artist. The same body as in POST is requiredDELETE /artist/:id- delete artist
GET /album- get all albumsGET /album/:id- get single album byidPOST /album- create album. Body is required:{ "name": string, "year": number, "artistId": string | null // refers to Artist }PUT /album/:id- update album. The same body as in POST is requiredDELETE /album/:id- album artist
GET /track- get all tracksGET /track/:id- get single track byidPOST /track- create track. Body is required:{ "name": string, "artistId": string | null // refers to Artist "albumId": string | null // refers to Album "duration": integer }PUT /track/:id- update track. The same body as in POST is requiredDELETE /track/:id- album track
GET /favs- get all favoritesPOST /favs/track/:id- add track to the favorites by itsidDELETE /favs/track/:id- delete track from favoritesPOST /favs/album/:id- add album to the favorites by itsidDELETE /favs/album/:id- delete album from favoritesPOST /favs/artist/:id- add artist to the favorites by itsidDELETE /favs/artist/:id- delete artist from favorites
After application running open new terminal and enter:
To run all tests without authorization
npm run test
To run only one of all test suites
npm run test -- <path to suite>
To run all test with authorization
npm run test:auth
To run only specific test suite with authorization
npm run test:auth -- <path to suite>