Build the image(s):
docker-compose build
Run the container(s):
docker-compose up
Seed the database:
cd server
python3 init_db.py
Access the database via psql:
docker-compose exec database psql -U admin
Create a Python virtual environment:
python3 -m venv server
Activate the virtual environment:
cd server
source bin/activate
Install dependencies:
cd server
pip3 install requirements.txt
Start the web server
cd server
python3 app/main.py
GET /api/test
Just a test route to check if the web server is working.
Response
{
"message": "Yo mamma so fat even penguins are jealous of the way she waddles."
}
Return an array of all music artists.
Response
[
{
"id": 1,
"name": "Chad Crouch",
"websiteUrl": "https://www.soundofpicture.com/",
"location": "Portland, Oregon"
},
{
"id": 2,
"name": "Brevyn",
"websiteUrl": "http://vulpianorecords.com/",
"location": null
},
{
"id": 3,
"name": "Ketsa",
"websiteUrl": "https://ketsa.uk//",
"location": "London"
}
]
Create a new music artist.
Request
{
"name": "New Artist",
"websiteUrl": "https://website.com/",
"location": "Planet Earth"
}
Response
{
"id": 9,
"message": "Artist created successfully"
}
200 | Artist created successfully
Update a music artist.
Request
{
"id": 6,
"name": "Hype Artist",
"websiteUrl": "https://example.com/",
"location": "Somewhere on Earth"
}
Response
{
"message": "Artist updated successfully"
}
200 | Artist updated successfully
404 | Artist does not exist
Delete a music artist with the given id.
Response
204 | No Content (deleted)
404 | Artist does not exist
Return a track with the given id.
Response
{
"id": 1,
"name": "Algorithms",
"musicFileUrl": "https://music-collector.github.io/music/electronic/arps/Chad_Crouch_-_01_-_Algorithms.mp3",
"artistId": 1
}
200 | Success
404 | Track does not exist
Create a new track.
Request
{
"name": "New Track",
"musicFileUrl": "https://example.com/track.mp3",
"artistId": 1
}
Response
{
"id": 62,
"message": "Track created successfully"
}
200 | Track created successfully
400 | Invalid foreign key
Update a track.
Request
{
"id": 62,
"name": "New Track 2",
"musicFileUrl": "https://example.com/track2.mp3",
"artistId": 2
}
Response
{
"message": "Track updated successfully"
}
200 | Track updated successfully
400 | Invalid foreign key
404 | Track does not exist
Delete a track with the given id.
Response
204 | No Content (deleted)
404 | Track does not exist
Return an array of all music albums for the corresponding artist.
Response
[
{
"id": 1,
"name": "Arps",
"websiteUrl": "https://www.soundofpicture.com/",
"artistId": 1,
"coverArtFileUrl": "https://music-collector.github.io/music/electronic/arps/Chad_Crouch_-_Arps_-_20190913144052757.jpg",
"description": "With 'Arps' Portland, Or. composer/producer Chad Crouch has created a collection of warm analog synth tracks with arpeggiated melodies that recall the late 70’s early 80’s golden era of electronic music. Meditative, undulating, sweeping synth parts weave together in a reflective, melodic reverie. Touchstones include Air, OMD, The theme song to Stranger Things, and Kraftwerk."
},
{
"id": 2,
"name": "Drifter",
"websiteUrl": "https://www.soundofpicture.com/",
"artistId": 1,
"coverArtFileUrl": "https://music-collector.github.io/music/electronic/drifter/Chad_Crouch_-_Drifter_-_20190805125622490.jpg",
"description": "Portland, Or. composer/producer Chad Crouch has been on a bohemian power-ballad streak and 'Drifter' collects the cream of the crop. The instrumental compositions are mellow, melodic, meandering and multifaceted. Arrangements feature electric piano, electric bass, drums, synth, vibes, strings and detailed percussion, while melodies veer toward the sunny side of the street. It's a uniquely organic chill-out suite with heart."
},
{
"id": 3,
"name": "Night Tracks",
"websiteUrl": "https://www.soundofpicture.com/",
"artistId": 1,
"coverArtFileUrl": "https://music-collector.github.io/music/electronic/night-tracks/Chad_Crouch_-_Night_Tracks_-_20190622142220691.jpg",
"description": null
}
]
200 | Success
400 | Artist does not exist
Return a music album with the given id and all its tracks.
Response
{
"id": 1,
"name": "Arps",
"websiteUrl": "https://www.soundofpicture.com/",
"artistId": 1,
"coverArtFileUrl": "https://music-collector.github.io/music/electronic/arps/Chad_Crouch_-_Arps_-_20190913144052757.jpg",
"description": "With 'Arps' Portland, Or. composer/producer Chad Crouch has created a collection of warm analog synth tracks with arpeggiated melodies that recall the late 70’s early 80’s golden era of electronic music. Meditative, undulating, sweeping synth parts weave together in a reflective, melodic reverie. Touchstones include Air, OMD, The theme song to Stranger Things, and Kraftwerk.",
"tracks": [
{
"id": 1,
"name": "Algorithms",
"musicFileUrl": "https://music-collector.github.io/music/electronic/arps/Chad_Crouch_-_01_-_Algorithms.mp3",
"artistId": 1,
"order": 1
},
{
"id": 2,
"name": "Elipsis",
"musicFileUrl": "https://music-collector.github.io/music/electronic/arps/Chad_Crouch_-_02_-_Elipsis.mp3",
"artistId": 1,
"order": 2
},
{
"id": 3,
"name": "Illustrated Novel",
"musicFileUrl": "https://music-collector.github.io/music/electronic/arps/Chad_Crouch_-_03_-_Illustrated_Novel.mp3",
"artistId": 1,
"order": 3
}
]
}
200 | Success
404 | Album does not exist
Create a new album.
Request
{
"name": "New Album",
"websiteUrl": "https://example.com",
"artistId": 1,
"coverArtFileUrl": "https://example.com/cover-art.png",
"description": "Sugar plum gummi bears jelly-o ice cream croissant. Sugar plum lollipop muffin pudding chocolate dragée macaroon. Marzipan powder sugar plum."
}
Response
{
"id": 10,
"message": "Album created successfully"
}
200 | Album created successfully
400 | Invalid foreign key
Update an album and its tracks.
Request
{
"id": 7,
"name": "New Album 2",
"websiteUrl": "https://example2.com",
"artistId": 2,
"coverArtFileUrl": "https://example.com/cover-art2.png",
"description": "Sugar2 plum gummi bears jelly-o ice cream croissant. Sugar plum lollipop muffin pudding chocolate dragée macaroon. Marzipan powder sugar plum.",
"tracks": [
{
"id": 1,
"order": 1
},
{
"id": 2,
"order": 2
},
{
"id": 3,
"order": 3
}
]
}
Response
{
"message": "Album updated successfully"
}
200 | Album updated successfully
400 | Invalid foreign key
404 | Album does not exist
Delete an album with the given id.
Response
204 | No Content (deleted)
404 | Album does not exist