Minute REST-API built while learning the Gin Framework
- Go
- PostgreSQL
- Make
- Git
- Clone the project.
- Create a database.
- Use album.sql to create the tables and insert dummy data.
- Set the following environmental variables.
export DB_NAME=<your db name>
export DB_PASS=<your postgres password>
export DB_USER=<your postgres username>- Cd into the project and run the following command
make run- Make request to localhost:8080/albums
-
GET /albums
Returns a list of all albums
-
POST /albums
Adds a new album
{ "title": "Kolos", "artist": "Meshuggah", "price": 45.78 } -
GET /albums/:id
Returns an album with the specified id
Example: localhost:8080/albums/3