- Post a recommendation on the plataform
- Upvote and downvote a recommendation
- Get the last 10 recommendations added
- Get the top 10 recommendations added
- Get a random recommendation from the app
To post a recommendation by the back-end:
POST /recommendations
Body | Type | Description |
---|---|---|
name |
string |
Required and Unique. The name of the song you're recommending |
youtubeLink |
string |
Required. YouTube link from the song |
Getting a upvote for the recommendation
POST /recommendations/:id/upvote
Params | Description |
---|---|
id |
Required. Id from the recommendation you want to upvote |
Getting a downvote for the recommendation
POST /recommendations/:id/downvote
Params | Description |
---|---|
id |
Required. Id from the recommendation you want to downvote |
Seeing the last 10 added recommendations
GET /recommendations
[
{
"id": 2,
"name": "Love on the Brain",
"youtubeLink": "https://www.youtube.com/watch?v=QMP-o8WXSPM&ab_channel=Rihanna-Topic",
"score": 100
},
{
"id": 1,
"name": "Chitãozinho E Xororó - Evidências",
"youtubeLink": "https://www.youtube.com/watch?v=ePjtnSPFWK8&ab_channel=CHXVEVO",
"score": 245
}
]
Seeing the most scored recommendations.
GET /recommendations/top/:amount
Params | Description |
---|---|
amount |
Required. Amount of recommendations to be shown |
[
{
"id": 1,
"name": "Chitãozinho E Xororó - Evidências",
"youtubeLink": "https://www.youtube.com/watch?v=ePjtnSPFWK8&ab_channel=CHXVEVO",
"score": 245
},
{
"id": 2,
"name": "Love on the Brain",
"youtubeLink": "https://www.youtube.com/watch?v=QMP-o8WXSPM&ab_channel=Rihanna-Topic",
"score": 100
}
]
Seeing one recommendation that was required by ID.
GET /recommendations/:id
Params | Description |
---|---|
id |
Required. ID of recommendations to be shown |
{
"id": 1,
"name": "Chitãozinho E Xororó - Evidências",
"youtubeLink": "https://www.youtube.com/watch?v=ePjtnSPFWK8&ab_channel=CHXVEVO",
"score": 245
}
Seeing one recommendation that the application will choose.
GET /recommendations/random
{
"id": 1,
"name": "Chitãozinho E Xororó - Evidências",
"youtubeLink": "https://www.youtube.com/watch?v=ePjtnSPFWK8&ab_channel=CHXVEVO",
"score": 245
}
git clone git@github.com:thaisealves/sing-me-a-song.git
npm run dev
npm start
npx cypress open
npm test
npm run test:unit
Obs.: All the tests are setted to the .env.test file, so it has to be created. If trying to run on .env, you have to create a database by prisma:
npx prisma migrate dev