Api developed in Golang with Codely TV course
The chosen domain is the discogs API. The idea is to create a simple API that allows you to search for a release. Being a release a music album, a single, a compilation, etc. For now, the properties are:
- Id (uuid)
- Title
- Released: release date
- Resource url (in the discogs api)
- Uri (in the web)
- Year
- POST /releases: Create a new release
Sample request:
{
"id": "BAD92BF5-9176-47BD-BCC6-8C38A5394A6E",
"title": "ultra mono",
"released": "2020-09-25",
"resource_url": "https://api.discogs.com/releases/15951324",
"uri": "https://www.discogs.com/release/15951324-Idles-Ultra-Mono",
"year": "2020"
}
- GET /releases: Get all releases. Params
- limit: number of releases to return
Sample response:
[
{
"id": "BAD92BF5-9176-47BD-BCC6-8C38A5394A6E",
"title": "ultra mono",
"released": "2020-09-25",
"resource_url": "https://api.discogs.com/releases/15951324",
"uri": "https://www.discogs.com/release/15951324-Idles-Ultra-Mono",
"year": "2020"
},
{
"id": "BAD92BF5-9176-47BD-BCC6-8C38A5394A6F",
"title": "origin of symmetry",
"released": "2001-06-18",
"resource_url": "https://api.discogs.com/releases/15951324",
"uri": "https://www.discogs.com/release/15951324-Muse-Origin-Of-Symmetry",
"year": "2001"
}
]
After this, you can search for the release in database:
docker exec -ti go-api-example-mysql-1 bash
mysql -umhb -pmhb
use mhb;
select * from releases;
go mod download
make up
make test