demo-bookstore-api
Welcome to the Bookstore API project! This repository contains a RESTful API built using Go that allows you to manage a collection of books. Whether you're a book enthusiast or a developer looking to learn Go, this project provides a practical example of how to design and implement a web API.
Table of Contents
Features
- Create, Read, Update, and Delete (CRUD) operations for managing books.
- Error handling and validation for robust data processing.
- SQLite database integration for persistent storage.
- RESTful API design with clear and intuitive endpoints.
Getting Started
Prerequisites
Running the API
Install the dependencies
go get .
Run the server
go run main.go
API Documentation
Swagger API Documentation are automatically generated by swag.
Swagger API Documentation can be accessed at http://localhost:8080/swagger/index.html
Usage Examples
- Retrieve all books:
curl http://localhost:8080/api/v1/books
- Create a new book:
curl -X POST http://localhost:8080/api/v1/books -d '{"title": "Sample Book", "author": "John Doe", "genre": "Fiction"}'
- Update a book
curl -X PUT http://localhost:8080/api/v1/books/{bookID} -d '{"title": "Updated Book Title"}'
- Delete a book
curl -X DELETE http://localhost:8080/api/v1/books/{bookID}
Contributing
Contributions are welcome! If you find a bug or have an enhancement in mind, feel free to open an issue or submit a pull request.
License
This project is licensed under the MIT License.