ihumaunkabir / bookx

An informational API backend of books built in Go and MongoDB

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Bookx Go Report A+

Bookx is a simple API built in GO and MongoDB.

Getting Started

To get a local copy up and running follow these simple steps.

Prerequisites

  • Go 1.10 and higher
  • MongoDB Server 4.2.3
  • MongoDriver
go get go.mongodb.org/mongo-driver/mongo
  • gorilla/mux
go get -u github.com/gorilla/mux
  • Cobra
go get -u github.com/spf13/cobra/cobra

Installation

  1. Clone the repo
git clone https://github.com/oasiscse/bookx.git
  1. Go to project directory and run -
go run main.go serve

Endpoints

Create Book [POST]: /api/books/create
Get all books [GET]: /api/books/info/all
Get All Books By Year [GET]: /api/books/info/all/{year}
Get by Book ID [GET]: /api/books/info/{bookid}
Delete single Book by ID [DELETE]: /api/books/remove/{bookid}

Data

type Book struct {
	ID        primitive.ObjectID `json:"_id,omitempty" bson:"_id,omitempty"`
	Title     string             `json:"title,omitempty" bson:"title,omitempty"`
	Author    string             `json:"author,omitempty" bson:"author,omitempty"`
	Publisher string             `json:"psher,omitempty" bson:"psher,omitempty"`
	Year      string             `json:"year,omitempty" bson:"year,omitempty"`
	Category  string             `json:"cat,omitempty" bson:"cat,omitempty"`
	BookID    string             `json:"bookid,omitempty" bson:"bookid,omitempty"`
}

Contributing

Contributions are what make the open source community such an amazing place to be learn, inspire, and create. Any contributions you make are greatly appreciated.

  1. Fork the Project
  2. Open a Pull Request

License

Distributed under the MIT License.

Contact

Tweet me - @ihumaunkabir
Find me on ihumaun.com

About

An informational API backend of books built in Go and MongoDB

License:MIT License


Languages

Language:Go 100.0%