# go-gin-gorm-api **Repository Path**: dsysama/go-gin-gorm-api ## Basic Information - **Project Name**: go-gin-gorm-api - **Description**: 基于Gin+Gorm+Mysql搭建的简易增删改查api接口 - **Primary Language**: Go - **License**: Not specified - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 1 - **Forks**: 3 - **Created**: 2022-02-16 - **Last Updated**: 2023-11-09 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # Api go simple It is a just simple RESTful API with Go using: 1. **Gin Framework** 2. **Gorm** ## Installation & Run ```bash # Download Gin Framework $ go get github.com/gin-gonic/gin # Download GORM $ go get github.com/jinzhu/gorm ``` Setting DB in settings-dev.yaml ```go mysql: name: 'root' host: '127.0.0.1' port: 3306 password: 'root' dbName: 'test_gin' ``` ## Structure ``` ├── Models │ ├── Book.go // Book models | ├── Scheme.go // Book struct and tabel ├── Config │ └── Config.go // Config struct ├── Controllers │ └── Book.go // Book Controller ├── Global │ └── GlobarVar.go // Global variables ├── Initialize │ └── Config.go // Config initialize │ └── Mysql.go // Mysql initialize │ └── Router.go // Router initialize ├── ApiHelpers │ └── Response.go // response function ├── Routers | └── Routers.go // Routers └── main.go ``` ## API #### /book - `GET` : Get all book - `POST` : Create a new book #### /book/:id - `GET` : Get a book - `PUT` : Update a book - `DELETE` : Delete a book