The Bookstore Management API is a simple RESTful service built with Go. It provides CRUD operations for managing a collection of books, including creating, reading, updating, and deleting book records.
- Create Book: Add a new book to the bookstore.
- Get All Books: Retrieve the list of all books.
- Get Book by ID: Fetch details of a specific book by its ID.
- Update Book: Update details of an existing book.
- Delete Book: Remove a book from the collection.
- Golang: Programming language used to build the API.
- Gorilla Mux: Router for handling HTTP requests.
- JSON: Data format for request and response payloads.
- URL:
/books
- Method:
GET
- Response:
[ { "ID": 1, "Name": "Book Name", "Author": "Author Name", "Publication": "Publisher" } ]
- URL:
/books/{bookId}
- Method:
GET
- Response:
{ "ID": 1, "Name": "Book Name", "Author": "Author Name", "Publication": "Publisher" }
- URL:
/books
- Method:
POST
- Request Body:
{ "Name": "New Book", "Author": "New Author", "Publication": "New Publisher" }
- Response:
{ "ID": 2, "Name": "New Book", "Author": "New Author", "Publication": "New Publisher" }
- URL:
/books/{bookId}
- Method:
PUT
- Request Body:
{ "Name": "Updated Name", "Author": "Updated Author", "Publication": "Updated Publisher" }
- Response:
{ "ID": 1, "Name": "Updated Name", "Author": "Updated Author", "Publication": "Updated Publisher" }
- URL:
/books/{bookId}
- Method:
DELETE
- Response:
{ "ID": 1, "message": "Book deleted successfully" }
-
Clone the repository:
git clone https://github.com/harshal-rembhotkar/bookstore-management-api.git
-
Navigate to the project directory:
cd bookstore-management-api
-
Install dependencies:
go mod tidy
-
Run the application:
go run main.go
-
Access the API at
http://localhost:9010