# go-restful-quick-build **Repository Path**: luzhihaoTestingLab/go-restful-quick-build ## Basic Information - **Project Name**: go-restful-quick-build - **Description**: Golang Web手脚架。基于Go语言和beego框架, 具备MVC代码生成功能,能快速搭建RESTful风格的轻量Golang后台 - **Primary Language**: Unknown - **License**: Not specified - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 2 - **Created**: 2024-12-01 - **Last Updated**: 2025-09-23 ## Categories & Tags **Categories**: Uncategorized **Tags**: Web ## README # go-restful-quick-build Golang Web手脚架。基于Go语言和beego框架, 具备MVC代码生成功能,能快速搭建RESTful风格的轻量Golang后台 gitee: https://gitee.com/luzhihaoTestingLab/go-restful-quick-build.git 项目借鉴了 https://github.com/Echosong/beego_blog.git ## 使用说明: 1 . 初始化 $ go mod tidy # 拷贝db_beego.sql中的sql到MYSQL数据库中执行建表 2 . 运行 $ go run main.go 3 . 编译二进制文件 $ go build main.go 4 . 修改 app.conf 配置 #MYSQL地址 dbhost = localhost #MYSQL端口 dbport = 3306 #MYSQL用户名 dbuser = root #MYSQL密码 dbpassword = root #MYSQL数据库名称 dbname = default 5 . 修改table.toml, 数据库信息同上, tables为需要基于数据表生成的MVC文件代码的表名称 [database] dbname = "default" user = "root" password = "root" host = "localhost" port = "3306" # 新建数据表列表,格式严格如 createNewTables = "A,B,C" [create] tables = "teacher,student" 6 . 运行代码生成文件 $ go run code-gen/mvc_gen.go 7 . 需手动配置代码的地方 models/register_model.go func register_model() { ... // 需手动新增新模型 orm.RegisterModel(new(Teacher), new(Student)) } routers/router.go func init() { ... // 在此添加新路由 Teacher_init() Student_init() } routers/student.go func Student_init() { ... // 可能还需要新的接口,在此添加 beego.Router("/student/call", &controllers.StudentController{}, "post:Call") } routers/teacher.go ... 8 . 联系方式 qq: 315387732 邮箱: 315387732@qq.com