一个Gin + Gorm + Mysql + bootstrap实现的博客,采用MVC架构。
|-controller
|-dao
|-router
|-model
|-assets
|-templates
git clone https://github.com/youke0721/GinTodo.git
- 在你的数据库中执行以下命令,创建本项目所用的数据库:
CREATE DATABASE golang_blog DEFAULT CHARSET=utf8mb4;
- 在
dao.go
文件中配置数据库连接信息。
dsn := "你的数据库用户名:你的数据库密码6@tcp(127.0.0.1:3306)/golang_db?charset=utf8mb4&parseTime=True&loc=Local"
go run main.go
启动之后,使用浏览器打开http://127.0.0.1:8080/即可。