Skip to content

AbellasJuan/sing-me-a-song

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

71 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Have you ever asked someone for a music recommendation?

About

Sing me a song is an API for anomalous music recommendation. The more people like a recommendation, the greater the chance that it will be recommended to others 🙂 .


How It Works

POST /recommendations

POST /recommendations

Expected Body

{
  "name": String, required,
  "youtubeLink": String, must be a valid youtube link, required,
}

Possible Response Status

200: 'OK';
400: 'The request body contains invalid elements';
201: 'Successfully created!';
409: 'Link already registered';
500: 'Server Error'

POST /recommendations/:id/upvote

POST /recommendations/:id/upvote

Expected Body

None

Possible Response Status

400: 'Id is invalid';
200: 'Successfully updated! +1';
404: 'Recommendation not found';
500: 'Server Error'

POST /recommendations/:id/downvote

POST /recommendations/:id/downvote

Expected Body

None

Possible Response Status

400: 'Id is invalid';
200: 'Successfully updated! -1';
404: 'Recommendation not found';
500: 'Server Error'

GET recommendations/random

GET recommendations/random

Possible Response Status

400: 'Id is invalid';
200: 'Object with expected body'
404: 'No recommendations yet';
500: 'Server Error'

GET recommendations/top/:amount

GET recommendations/top/:amount

Expect to receive

[
  {
    "id": 1,
    "name": "Chitãozinho E Xororó - Evidências",
    "youtubeLink": "https://www.youtube.com/watch?v=ePjtnSPFWK8&ab_channel=CHXVEVO",
    "score": 250
  },
  {
    "id": 2,
    "name": "Chitãozinho E Xororó ft. Marília Mendonça - Página de Amigos",
    "youtubeLink": "https://www.youtube.com/watch?v=Etvt6Cme8u0&ab_channel=CHXVEVO",
    "score": 220
  },
  {
    "id": 3,
    "name": "Chitãozinho E Xororó - Fio de Cabelo",
    "youtubeLink": "https://www.youtube.com/watch?v=48kf5eG5yeY&ab_channel=ClassicoVEVO",
    "score": 200
  }
]

Possible Response Status

400: 'Invalid amount';
200: 'Object with expected body'
404: 'No recommendations yet';
500: 'Server Error'

Pre-requisites

Before you begin, you will need to have the following tools installed on your machine: Git, Node.js, VSCode.

Running the Backend (server)


// Install the dependencies
$ npm install

// Create a .env.dev file and fill it using your environment variables following the .env.example

// Run the application in development mode
$ ntl -> start:dev

// The server will start at port: 5000

## Tech Stack

The following tools were used in the construction of the project-api:

**Server**  ([NodeJS](https://nodejs.org/en/))

-   **[Express](https://expressjs.com/)**
-   **[CORS](https://expressjs.com/en/resources/middleware/cors.html)**
-   **[Pg](https://github.com/brianc/node-postgres)**
-   **[DotENV](https://github.com/motdotla/dotenv)**
-   **[Joi](https://github.com/hapijs/joi)**
-   **[Jest](https://github.com/facebook/jest)**
-   **And others...**

**Utilitários**

-   Editor:  **[Visual Studio Code](https://code.visualstudio.com/)**
-   API Test:  **[Insomnia](https://insomnia.rest/)**
---

## How to contribute

1. Fork the project.
2. Create a new branch with your changes: `git checkout -b feat/myFeatureName`
3. For each feature implemented, make a commit specifying what was done
4. Submit your changes: `git push -u origin feat/myFeatureName`

---

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • TypeScript 46.4%
  • JavaScript 43.7%
  • HTML 5.5%
  • CSS 4.2%
  • Shell 0.2%