# go **Repository Path**: yusteven/go ## Basic Information - **Project Name**: go - **Description**: go language related. - **Primary Language**: Unknown - **License**: Not specified - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2024-11-22 - **Last Updated**: 2024-12-22 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README #使用Gin框架编写一个web api server #20241129-v1.0 第一个版本 #特点: 1.使用http协议的api操作server。 2.配置文件采用本地yaml文件格式,当配置文件为空时,读取系统默认配置。 3.后端采用的MySQL作为数据的持久化存储方式。 yaml文件配置: ```yaml app: host: 127.0.0.1 port: 8090 mysql: host: 127.0.0.1 port: 3306 database: test username: "root" password: "root" debug: false ``` 默认配置: ```go var ConfigIns = &Config{ App: &App{ Host: "127.0.0.1", Port: 8080, }, MySql: &MySql{ Username: "root", Password: "root", HostIP: "127.0.0.1", Port: 3306, Database: "test", Protocol: "tcp", Debug: false, }, } ``` #示例: ```sh curl -X POST http://localhost:8080/api/books -H "Content-Type: application/json" -d '{"title": "Go05", "author": "test05", "price": 8.99,"is_sale": true}' ```