poc-book-api-golang

command module
v0.0.0-...-1f3db5e Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 9, 2021 License: Apache-2.0 Imports: 8 Imported by: 0

README

poc-book-api-golang

Description

POC of a Book REST API using gorilla/mux (a powerful HTTP router and URL matcher for building Go web servers).

Prerequisites

Golang
  • Go installed
  • GOPATH configured
Dependency
  • go get -u github.com/gorilla/mux

How to use?

On the repo root directory, run: go run .

Obs: You should see something like this:

YYYY/MM/DD HH:mm:ss file load took 11.617198ms
YYYY/MM/DD HH:mm:ss Start Book Rest API

Then, consume the services below on your Rest Client tool.

Services

Create new book

POST: http://localhost:8080/books

{
    "book_id": "50000",
    "title": "Book Title",
    "authors": "Author Name",
    "average_rating": "4.99",
    "isbn":"1234567890",
    "isbn_13":"1234567890123",
    "language_code":"eng",
    "num_pages":"500",
    "ratings":"100",
    "reviews":"50"
}

create book


Get book by author

GET: http://localhost:8080/books/authors/{author}

get book by author


Get book by name

GET: http://localhost:8080/books/book-name/{bookName}

get book by name


Get Book by ISBN (International Standard Book Number)

GET: http://localhost:8080/books/isbn/{isbn}

get book by isbn


Update Book by ISBN (International Standard Book Number)

PUT: http://localhost:8080/books/isbn/{isbn}

{
    "book_id": "8429",
    "title": "Insects & Spiders",
    "authors": "David Burnie",
    "average_rating": "4.33",
    "isbn":"0783548818",
    "isbn_13":"9780783548814",
    "language_code":"eng",
    "num_pages":"64",
    "ratings":"3",
    "reviews":"0"
}

update book


Delete Book by ISBN (International Standard Book Number)

DELETE: http://localhost:8080/books/isbn/{isbn}

delete book

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL