bookstoreAPI

module
v0.0.0-...-a67acf8 Latest Latest
Warning

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

Go to latest
Published: Apr 7, 2024 License: GPL-3.0

README

Bookstore API

Book store API with CRUD and SQLite3

Prerequisites

How to build

Run following commands to build app:

go mod tidy
go build -o tmp/bookstore cmd/main.go

How to run

Run binary image with this command:

./tmp/bookstore

How to send requests using curl

Create a new book:

curl -X POST -H "Content-Type: application/json" -d '{"title": "System Design Interview", "author": "Alex Xu", "publisher":"ByteByteGo"}' localhost:8080/book/

Read/Get a list of books from database:

curl -X GET localhost:8080/book/

Read/Get single book:

curl -X GET localhost:8080/book/{id}

NOTE: {id} is a positive integer.

Update information of the book:

curl -X PUT -H "Content-Type: application/json" -d '{"title": "System Design Interview", "author": "Alex Xu", "publisher":"ByteByteGo"}' localhost:8080/book/{id}

NOTE: {id} is a positive integer.

Delete/Remove book from database:

curl -X DELETE localhost:8080/book/{id}

NOTE: {id} is a positive integer.

Directories

Path Synopsis
pkg

Jump to

Keyboard shortcuts

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