It is a just simple RESTful API with Go using:
- Gin Framework
- Gorm
# Download this project
$ go get github.com/dedidot/gorm-gin
# Download Gin Framework
$ go get github.com/gin-gonic/gin
# Download GORM
$ go get github.com/jinzhu/gormSetting DB in main.go
Config.DB, err = gorm.Open("mysql", "DBUSERNAME:DBPASSWORD@tcp(127.0.0.1:3306)/DBNAME?charset=utf8&parseTime=True&loc=Local")├── Models
│ ├── Book.go // Book models
| ├── Scheme.go // Book struct and tabel
├── Config
│ └── Database.go // Global DB
├── Controllers
│ └── Book.go // Book Controller
├── ApiHelpers
│ └── Response.go // response function
├── Routers
| └── Routers.go // Routers
└── main.go
GET: Get all bookPOST: Create a new book
GET: Get a bookPUT: Update a bookDELETE: Delete a book
#Post Params
{
"author": "Op Super John Doe Bilw",
"name": "Implementation Golang",
"category": "Knowledge"
}