This project is a simple CRUD (Create, Read, Update, Delete) API for managing albums, built using the Go programming language and the Gin web framework.
- Implement CRUD API and connect to UI
- Implement JWT Auth and middleware for protected routes
- Setup CORS middleware
- Implement UI and serve via Go Gin
- Connect to DB
- Dockerize the app
- And more
- Create a new album
- Retrieve a list of all albums
- Retrieve a specific album by ID
- Update an existing album
- Delete a album
- Go 1.23.4 (Used for development) or higher
- Gin web framework
-
Clone the repository:
git clone https://github.com/manjushsh/go-song-album.git cd go-song-album
-
Install the dependencies:
go mod tidy
To start the server, run:
go run main.go
The server will start on http://localhost:8080
.
-
Endpoint:
POST /albums
-
Request Body:
{ "id": "1", "title": "Album Title", "artist": "Artist Name", "price": 9.99 }
-
Response:
{ "id": "1", "title": "Album Title", "artist": "Artist Name", "price": 9.99 }
-
Endpoint:
GET /albums
-
Response:
[ { "id": "1", "title": "Album Title", "artist": "Artist Name", "price": 9.99 }, { "id": "2", "title": "Another Album", "artist": "Another Artist", "price": 12.99 } ]
-
Endpoint:
GET /albums/:id
-
Response:
{ "id": "1", "title": "Album Title", "artist": "Artist Name", "price": 9.99 }
-
Endpoint:
PUT /albums/:id
-
Request Body:
{ "title": "Updated Album Title", "artist": "Updated Artist Name", "price": 10.99 }
-
Response:
{ "id": "1", "title": "Updated Album Title", "artist": "Updated Artist Name", "price": 10.99 }
-
Endpoint:
DELETE /albums/:id
-
Response:
{ "message": "Album deleted successfully" }
Contributions are welcome! Please open an issue or submit a pull request.
This project is licensed under the MIT License. See the LICENSE file for details.