Skip to content

slayer321/bookstore

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

4 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸ“š Bookstore

This is simple project which uses gRPC along with buf.build to create a bookstore backend where you can store all the books that you have read. It uses cassandra as it Database.

πŸ› οΈ Pre-requisite

If you already have cassandra db running on your system run below command to create the keyspace and it's schema.

create keyspace bookstore with replication = { 'class' : 'SimpleStrategy', 'replication_factor' : 1 };
create table bookstore.books(id UUID, title text, author text, pages int, publisher text, PRIMARY KEY(title));

We also have a make command which will setup all this for you. You just need install docker and buf cli. And run below command

Note: Clone the repo

make db

πŸš‹ Usage

Note: Run it from root of the project

Open the first terminal and run below commands.

$ go run cmd/main.go

Open second terminal and run below commands.

  • Add Book
$ buf curl \
  --schema api \
  --data '{"title": "The Alchemist","author": "Paulo Coelho", "pages": 197,"publisher": "HarperCollins"}' \
  http://localhost:8080/book.v1.InventoryService/AddBooks
$ buf curl \
  --schema api \
  --data '{"title": "Kafka on shore","author": "Haruki Murakami", "pages": 505,"publisher": "HarperCollins"}' \
  http://localhost:8080/book.v1.InventoryService/AddBooks
  • Get Book
$ buf curl \
  --schema api \
  --data '{"title": "The Alchemist"}' \
  http://localhost:8080/book.v1.InventoryService/GetBooks
  • Delete Book
$ buf curl \
  --schema api \
  --data '{"title": "The Alchemist"}' \
  http://localhost:8080/book.v1.InventoryService/DeleteBooks
  • Update Book
$ buf curl \
  --schema api \
  --data '{"title": "Kafka on shore","author": "Haruki Murakami2", "pages": 5051,"publisher": "HarperCollinss"}' \
  http://localhost:8080/book.v1.InventoryService/UpdateBooks

πŸ™Œ Credits

edouard-lopez : Progess Bar

🍁 Contributing

If you want to add new features or find a bug raise an issue.

About

πŸ“š Simple Bookstore

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published