UCLA-Creative-Labs / spot-the-song

MIT License
2 stars 0 forks source link

🚀 Feature: add GET songs endpoint #6

Open darren2hang opened 1 year ago

darren2hang commented 1 year ago

Endpoint to be used to retrieve all the songs in the songs collection. Return the song name, id, and a list of the names of the artists

Use Case

Set this as the GET endpoint at the route /song

Proposed Solution

Make a new route /song and make it in a new file @aurgy/server/www/song.ts

Use the Song.all() function to get all the songs and then filter the result to only return the data we want

We want to return an array of song objects that only contain the name, id, and a list of the artists.

It would look something like:

[
  {
    name: 'Never gonna give you up',
    id: '0jRtIxbK0KxaSlJW13ZOp',
    artists: [ 'Rick Astley'],
  },
  {
    name: 'STAY (with Justin Bieber)',
    id: 'R3W0jRkwqbK0KxaKWnJA43ZYm',
    artists: [
      'The Kid LAROI',
      'Justin Bieber',
    ], ...
]

This is a :rocket: Feature Request

aparnahrn commented 1 year ago

I'll take this one!