笔者对代码有优化更新。
一个基于gin+gorm开发的练手小项目,通过该项目可初识go web开发该有的姿势。
git clone https://github.com/palp1tate/bubble.git
- 在你的数据库中执行以下命令,创建本项目所用的数据库:
CREATE DATABASE bubble DEFAULT CHARSET=utf8mb4;
- 在
mysql.go
文件中配置数据库连接信息。
go build
./bubble
启动之后,使用浏览器打开http://127.0.0.1:8080/即可。