A basic go based REST API built for learning purpose.
- No third-party packages/dependencies
- [✔]
GET /book
returns list of books as JSON - [✔]
GET /book/{id}
returns details of a specific book as JSON - [✔]
POST /book
accepts a new book to be added - [✔]
POST /book
returns status 415 if content is notapplication/json
A book object should look like this:
{
"id": 3,
"title": "The Book of Life",
"author": "Krishnamurti",
"language": "English",
"genres": [
"non-fiction",
"philosophy"
]
}
There is no persistence, a global variable is used with RWMutex lock.
Since, no third-patry packages are used; just hit:
go run main.go