Skip to content

PremPatel8/Golang_REST_API

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 

Repository files navigation

Golang_REST_API

Simple RESTful API to create, read, update and delete books using in-memory database.

Quick Start

# Install mux router
go get -u github.com/gorilla/mux
go build
./Golang_REST_API

Endpoints

Get All Books

GET api/books
http://localhost:8000/books

Get Single Book

GET api/books/{id}
http://localhost:8000/books/1

Delete Book

DELETE api/books/{id}
http://localhost:8000/books/1

Create Book

POST api/books
http://localhost:8000/books

# Request sample
{
    "isbn":"4545454",
    "title":"Book Three",
    "author":{"firstname":"Harry",  "lastname":"White"}
}

Update Book

PUT api/books/{id}
http://localhost:8000/books/2

# Request sample
{
    "isbn":"89878987",
    "title":"Surface Detail",
    "author":{"firstname":"Ian",  "lastname":"Banks"}
}

About

Golang REST API CRUD demo

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages