An api made for you to recommend songs and receive recommendations
GET /recommendations/random
- 200: Success
{
"id": recommendationId,
"name": recommendationName,
"youtube_link": recommendationLink,
"score": recommendationScore
}
if you get nothing from this request with a 200 status, it is because there is no music registered yet
GET /recommendations/top/:amount
- 400: You have sent a invalid amount
- 200: Success
[
{
"id": recommendationId,
"name": recommendationName,
"youtube_link": recommendationLink,
"score": recommendationScore
},
]
POST /recommendations
{
name: String, at least 2 characters,
youtube_link: String, must be a valid youtube link
}
- 400: You have sent a invalid body, check your params
- 409: This music name or link is already been recommended
- 201: Success
POST /recommendations/:recommendation_id/upvote
- 400: You have sent a invalid id
- 404: The recommendation does not exist
- 204: Success
POST /recommendations/:recommendation_id/downvote
- 400: You have sent a invalid id
- 404: The recommendation does not exist
- 204: Success
git clone https://github.com/victordurco/sing-me-a-song-api
cd sing-me-a-song-api
npm i
Create a .env.dev file and fill it using your environment variables following the .env.dev.example
sudo su postgres
psql
CREATE DATABASE sing_me_a_song
\c sing_me_a_song
Copy everything in the DUMP.sql file and paste on the terminal
You can not exit the postgres admin, and run
npm run start:dev
Create a .env.test file and fill it using your environment variables following the .env.test.example file
sudo su postgres
psql
CREATE DATABASE sing_me_a_song_test;
\c sing_me_a_song_test
Copy everything in the DUMP.sql file and paste on the terminal
You can not exit the postgres admin, and run
npm run test
You can interact with the server running on this link