A simple Node REST API to manage artists and musics 🚀
Run the following commands:
# Unzip and move in the folder
unzip resources.zip
cd resources
# Copy the required env variables inside the file .env
cp .env.example .env
###
# Please update the .env file before going further!
###
# To make sure your environment is loaded
direnv allow .env
# If the previous command didn't work
source .env
# Build the API images and start the containers
docker compose up
# Check if the server is running: you should get "Success"
curl -s http://localhost:8080/health | grep "Up" > /dev/null && echo "Success" || echo "Failure"
# Open the Visual Database Interface
xdg-open http://localhost:5555
id
: Stringemail
: Stringpassword
: Stringartists
: Artist[]
id
: Stringname
: Stringrating
: Intnationality
: StringmusicGender
: StringphotoUrl
: Stringmusics
: Music[]user
: UseruserId
: String
id
: Stringname
: Stringrating
: Inturl
: Stringartist
: ArtistartistId
: String
Endpoint: /health
Method: GET
Return
- 200: OK
Endpoint: xxx/auth/register
Method: POST
\
{
"email": "[email protected]",
"password": "xxxxx"
}
Return
- 201: Created
- 400: Bad request
- 409: Email already used
- 500: Internal server error
Endpoint: xxx/auth/login
Method: POST
Body:
{
"email": "[email protected]",
"password": "xxxxx"
}
Return
- 200: Accepted
- 400: Bad request
- 500: Internal server error
Endpoint: xxx/user
Method: GET
Header: accessToken
Return
- 200: OK
- 403: Forbidden
- 500: Internal server error
Endpoint: xxx/artist
Method: POST
Header: accessToken
Body:
{
"name": "xxx",
"rating": 0,
"nationality": "xxx",
"musicGender": "xxx",
"photoUrl": "xxx"
}
Return
- 201: Created
- 400: Bad request
- 403: Forbidden
- 409: Name already used
- 500: Internal server error
Endpoint: xxx/artist/:artistId
Method: GET
Header: accessToken
Return
- 200: OK
- 400: Bad request
- 403: Forbidden
- 500: Internal server error
Endpoint: xxx/artist/:artistId/music
Method: POST
Header: accessToken
Body:
{
"name": "xxx",
"rating": 0,
"url": "xxx"
}
Return
- 201: Created
- 400: Bad request
- 403: Forbidden
- 500: Internal server error