This project is a backend microservice for sharing books. It allows users to add, browse, borrow, and return books. The service is built using Go and MongoDB.
- Add Books: Users can add new books to the system.
- Browse Books: Users can view all books available for borrowing.
- Borrow Books: Users can borrow available books.
- Return Books: Users can return books they have borrowed.
These instructions will help you get the project up and running on your local machine for development and testing purposes.
- Clone the repository:
git clone [email protected]:varundeepsaini/booky.git
- Navigate to the project directory:
cd booky
- Run the service:
go run .
Set up the following environment variable:
MONGODB_URI
: The URI for your MongoDB instance.
The service exposes several endpoints for interacting with books:
- URL:
/api/v1/booky/
- Method:
PUT
- Body (JSON):
{ "title": "String", "author": "String", "description": "String", "available": Boolean }
- URL:
/api/v1/booky/
- Method:
GET
- URL:
/api/v1/booky/{book_id}/borrow
- Method:
PUT
- URL Parameters:
book_id=[string]
- URL:
/api/v1/booky/{book_id}/borrow/{borrow_id}
- Method:
POST
- URL Parameters:
book_id=[string]
borrow_id=[string]
Use Postman or a similar API testing tool to test the above endpoints.
- Go - The programming language used.
- MongoDB - Database used.
- Gorilla Mux - HTTP routing and URL matcher.