Simple library API to store and retrieve books using Go and MongoDB
First build a docker image using docker build . -t library:latest
and then to start the application, run docker-compose up -d
.
- List all books (GET /books)
- Filter books by ID (GET /books/{id})
- Add new book(s) (POST /books)
-
List all books:
curl --location --request GET 'localhost:8080/books'
-
Filter books by ID:
curl --location --request GET 'localhost:8080/books/1'
-
Add new book(s)
curl --location --request POST 'localhost:8080/books' \ --header 'Content-Type: application/json' \ --data-raw '[ { "id": "1", "title": "Harry Potter and the Philosopher's Stone", "author": "J. K. Rowling", "cost": 599, "year": 1997, "publisher": "Bloomsbury" } ]'