Sing me a song is an application for anonymous song recommendation. The more people like a recommendation, the more likely it is to be recommended to others.
- Create a recommendation music
- Upvote and downvote each music
- Get a random music
- Get a specific top musics based in number of votes
POST /recommendation
Body | Type | Description |
---|---|---|
name |
string |
Required. recommendation name |
youtubeLink |
string |
Required. recommendation url |
youtubeLinkRegex = /^(https?\:\/\/)?(www\.youtube\.com|youtu\.?be)\/.+$/;
GET /recommendations
[
{
"id": 3,
"name": "Numb",
"youtubeLink": "https://www.youtube.com/watch?v=mRXKnG2eugU",
"score": 0
},
{
"id": 2,
"name": "Feels Like Home (Radio Edit)",
"youtubeLink": "https://www.youtube.com/watch?v=5CY1vbxP4Jo",
"score": 0
},
{
"id": 1,
"name": "All That Really Matters",
"youtubeLink": "https://www.youtube.com/watch?v=3gxxW5NqICc",
"score": 0
}
]
GET /recommendations/:id
Params | Type | Description |
---|---|---|
id |
number |
Required. |
{
"id": 1,
"name": "All That Really Matters",
"youtubeLink": "https://www.youtube.com/watch?v=3gxxW5NqICc",
"score": 0
}
POST /recommendations/:id/upvote
Params | Type | Description |
---|---|---|
id |
number |
Required. |
POST /recommendations/:id/downvote
Params | Type | Description |
---|---|---|
id |
number |
Required. |
GET /recommendations/top/:amount
Params | Type | Description |
---|---|---|
amount |
number |
Required. |
example = /recommendations/top/2
[
{
"id": 1,
"name": "All That Really Matters",
"youtubeLink": "https://www.youtube.com/watch?v=3gxxW5NqICc",
"score": 1
},
{
"id": 2,
"name": "Feels Like Home (Radio Edit)",
"youtubeLink": "https://www.youtube.com/watch?v=5CY1vbxP4Jo",
"score": 0
}
]
POST /recommendations/random
{
"id": 1,
"name": "All That Really Matters",
"youtubeLink": "https://www.youtube.com/watch?v=3gxxW5NqICc",
"score": 1
}
To run this project, you will need to add the following environment variables to your .env file
Back-end .env file
DATABASE_URL = postgres://UserName:Password@Hostname:5432/DatabaseName?schema=public
PORT = number #recommended:5000
NODE_ENV=development
Back-end .env.test file
DATABASE_URL = postgres://UserName:Password@Hostname:5432/DatabaseName-tests?schema=public
PORT = number #recommended:5000
NODE_ENV=test
Front-end .env file
REACT_APP_API_BASE_URL=http://
Clone the project
git clone https://github.com/thalesgomest/sing-me-a-song.git
Go to the project directory
cd sing-me-a-song/
Install dependencies
npm install
Start the server
npm run start
Go to the back-end project directory
cd sing-me-a-song/back-end
Install dependencies
npm install
Install prisma database
npx prisma migrate dev
For run only integration tests
npm run test:integration
For run only unitary tests
npm run test:unit
For run both tests: unitary and integration
npm run test
Go to the back-end project directory and up the server
cd sing-me-a-song/back-end
npm run dev
Go to the front-end project directory
cd sing-me-a-song/front-end
Install dependencies
npm install
Up the front-end application
npm start
Open cypress graphic interface
npx cypress open