This is a simple API that contains songs. It is created with Express. The data is read from JSON files & write to JSON files. This project is created as an answer to module 2.3 homework of Generasi GIGIH 3.0.
-
Make sure you have Node.js and Yarn installed on your computer.
-
Clone the repo.
git clone https://github.com/nadiannis/simple-spotify-playlist-api.git cd simple-spotify-playlist-api
-
Install the dependencies.
yarn
Run the development server.
yarn dev
GET /api/songs/most-played-songs
GET /api/songs
POST /api/songs
Request body example:
{
"title": "Stop This Train",
"artists": ["John Mayer"],
"url": "https://open.spotify.com/track/3E6iea9uEmB7gRru4lyP6h?si=8758d3dd306a414f"
}
GET /api/songs/:songId
PUT /api/songs/:songId
Request body example:
{
"title": "Bond",
"artists": ["Anomalie"],
"url": "https://open.spotify.com/track/0xcyIqCJ3rGfChfBxVF1FL?si=8b17481849024e01",
"playCount": 42
}
GET /api/songs/:songId/play
GET /api/playlists
POST /api/playlists
Request body example:
{
"name": "Favorites"
}
GET /api/playlists/:playlistId
PUT /api/playlists/:playlistId
Request body example:
{
"name": "My Favorites"
}
DELETE /api/playlists/:playlistId
GET /api/playlists/:playlistId/songs
POST /api/playlists/:playlistId/songs
Request body example:
{
"songId": "4efb36ed-b46e-4596-a440-192de9b6b321"
}
DELETE /api/playlists/:playlistId/songs/:songId
GET /api/playlists/:playlistId/songs/:songId/play