GoCrudBook
CRUD API example is written in Go using net/http
package and MySQL database.
Requirements
Project Structure
GoCrudBook
├── LICENSE.md
├── cmd
│ └── web
│ ├── config
│ │ └── config.go
│ ├── database
│ │ └── connection.go
│ ├── handler
│ │ └── handler.go
│ ├── main.go
│ └── router
│ └── router.go
├── go.mod
├── go.sum
├── gopher-lib.jpeg
├── pkg
│ └── models
│ ├── book.go
│ └── mysql
│ ├── book.sql
│ └── mysql.go
└── to-do.md
Instructions
Usage Examples
curl -X GET localhost:5000/book
curl -X GET "localhost:5000/book/id?id=1933988673"
- Get Book (by name) (enough to contain the word)
curl -X GET "localhost:5000/book/name?name=android"
curl -X POST localhost:5000/book/create -d
'{ "isbn" : 1932394161,
"book_name" : "Time To Go Forward",
"author": "3n0ugh",
"page_count" : 14,
"book_count": 1,
"borrow_times": 3,
"barrow_date": null,
"last_recieved_dat": null
}'
curl -X DELETE "localhost:5000/book/delete?id=1932394161"
curl -X PUT localhost:5000/book/update -d
'{ "isbn" : 1932394161,
"book_name" : "Time To Go Forward",
"author": "3n0ugh",
"page_count" : 14,
"book_count": 1,
"borrow_times": 3,
"barrow_date": null,
"last_recieved_dat": null
}'