Skip to content

DarlonGomes/sing-a-song-test

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

17 Commits
 
 
 
 
 
 

Repository files navigation

JavaScriptLogo

Sing me a Song

21th Project of Driven Education
A project where I test an existing application

Built With

Project Guide

Features

  • Get the recommendations list
  • Create a recommendation
  • Upvote and Downvote any recommendation
  • Remove a song when the score is lower than -5
  • Get the top 10 list
  • Get a random recommendation

API Reference

Create a song recommendation

POST /recommendations

Request:

Body Type Description
name string Required.
youtubeLink string Required. must conform to youtube regex


Upvote a song

POST /recommendations/:id/upvote

Request:

Params Type Description
id integer Required.

Downvote a song

POST /recommendations/:id/downvote

Request:

Params Type Description
id integer Required.

Gather recommendations

GET /recommendations

Response:

[
  {
    "id": 1,
    "name": "Danny Don't You Know - NSP",
    "youtubeLink": "https://www.youtube.com/watch?v=kT8cX2-_7pQ",
    "score": 9
  },
  {
    "id": 2,
    "name": "Cool Patrol - NSP",
    "youtubeLink": "https://www.youtube.com/watch?v=-tW0G9XWaj0",
    "score": 10
  },
  {
    "id": 3,
    "name": "Thunder & Lightning - NSP",
    "youtubeLink": "https://www.youtube.com/watch?v=-rSGoP5iGZQ",
    "score": 13
  }
]

Get a recommendation by id

GET /recommendations/:id

Request:

Params Type Description
id integer Required.

Example:

id: 3

Response:

[
   {
    "id": 3,
    "name": "Thunder & Lightning - NSP",
    "youtubeLink": "https://www.youtube.com/watch?v=-rSGoP5iGZQ",
    "score": 13
  }
]

Get a random recommendation

GET /recommendations/random

Response:

[
   {
    "id": 2,
    "name": "Cool Patrol - NSP",
    "youtubeLink": "https://www.youtube.com/watch?v=-tW0G9XWaj0",
    "score": 10
  }
]

Get a ranked list of song recommendations

GET /recommendations/top/:amount

Request:

Params Type Description
amount integer Required.

Example:

amount: 3

Response:

[
    {
    "id": 3,
    "name": "Thunder & Lightning - NSP",
    "youtubeLink": "https://www.youtube.com/watch?v=-rSGoP5iGZQ",
    "score": 13
  },
    {
    "id": 2,
    "name": "Cool Patrol - NSP",
    "youtubeLink": "https://www.youtube.com/watch?v=-tW0G9XWaj0",
    "score": 10
  },
    {
    "id": 1,
    "name": "Danny Don't You Know - NSP",
    "youtubeLink": "https://www.youtube.com/watch?v=kT8cX2-_7pQ",
    "score": 9
  }
  
]

Run Locally

Clone the project

    git clone https://github.com/DarlonGomes/sing-a-song-test

Go to the project directory

    cd sing-a-song-test/

Back-end

Go to the back-end directory

    cd back-end

Install dependencies

    npm install

Run prisma migrations

     npx prisma migrate dev

Start the server

     npm run start

Start Jest test

    npm run test

Start E2E test

    npm run E2E

Front-end


Go to the front-end directory

    cd front-end

Install dependencies

    npm install

Start the server

    npm start

Start Cypress - ( use E2E tests command in backend )

    npx cypress open

Lessons Learned

  • Jest: integration tests
  • Jest: unit tests
  • Jest: mock data
  • Cypress: E2E tests
  • Cypress: create a command
  • Cypress: DOM elements

Acknowledgements

Authors

  • Darlon Gomes is a student at Driven Education and is putting effort into switch careers. Nowadays he works with Fine Woodworking looking forward to become a Fullstack Dev.

About

21th project from Driven Web Dev Fullstack Bootcamp

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published