An API for managing a bookstore, built with Go and the Echo framework. This project allows users to browse, create, update, and delete book records.
This project is based on the example-go-api repository. Many concepts and structures were adapted and built upon from this source.
go get github.com/DATA-DOG/go-sqlmock
go get github.com/go-playground/validator/v10
go get github.com/google/uuid
go get github.com/labstack/echo/v4
go get github.com/stretchr/testify
go get github.com/swaggo/echo-swagger
go get github.com/swaggo/swag
go get go.uber.org/zap
go get gorm.io/driver/postgres
go get gorm.io/gorm
- To start the application locally:
go run main.go
- The API will be running at http://localhost:1323.
To run the test suite:
go test ./...
Method | Endpoint | Description |
---|---|---|
GET | /books | Get all books |
GET | /books/:id | Get a specific book |
POST | /books | Add a new book |
PUT | /books/:id | Update a book |
DELETE | /books/:id | Delete a book |
To add a new book:
POST /books
Content-Type: application/json
{
"title": "Clean Code",
"author": "Robert C. Martin",
"isbn": "9780132350884",
}