基于gin_scaffold开发Go语言的web项目
2021/5/30 18:24:02
本文主要是介绍基于gin_scaffold开发Go语言的web项目,对大家解决编程问题具有一定的参考价值,需要的程序猿们随着小编来一起学习吧!
源码地址:https://github.com/e421083458/gin_scaffold
提前配置好go mod(好用的GO包管理工具,本地需要的第三方包和别的本地目录都可以自动导入)
git clone git@github.com:e421083458/gin_scaffold.git cd gin_scaffold go mod tidy
之后在自己的git上新建一个新项目,把当前的remote git地址删除,
git remote rm origin
之后更新为自己的git仓库地址。
git remote add origin git@github.com:xx.git
打开目录,找到controller/api.go
package controller import ( "errors" "github.com/e421083458/gin_scaffold/dao" "github.com/e421083458/gin_scaffold/dto" "github.com/e421083458/gin_scaffold/middleware" "github.com/e421083458/golang_common/lib" "github.com/gin-gonic/contrib/sessions" "github.com/gin-gonic/gin" "strings" )
用goland全局替换“github.com/e421083458/gin_scaffold/” =》 “你的项目地址”
查看go.mod
第一行改成你的项目地址:module github.com/XXX/XX
本地装好mysql和redis。在这里配置:
此时运行项目:url后面的地址是你的项目地址
之后需要删除一些不需要的文件
controller 清空 dao清空
router/route.go 只留这些
重新启动
访问:http://127.0.0.1:8880/ping
这篇关于基于gin_scaffold开发Go语言的web项目的文章就介绍到这儿,希望我们推荐的文章对大家有所帮助,也希望大家多多支持为之网!
- 2024-09-05MongoDB入门:快速掌握NoSQL数据库基础
- 2024-08-28go 项目中怎么打印调试-icode9专业技术文章分享
- 2024-08-21swoole未来的发展前景与golang对比哪个更好-icode9专业技术文章分享
- 2024-08-16goland 已经下了中文插件了, 怎么设置成中文-icode9专业技术文章分享
- 2024-07-26使用 SendGrid 的 Go 客户端库能同时给多个邮箱发吗-icode9专业技术文章分享
- 2024-07-26使用 SendGrid 的 Go 客户端库时怎么设置header 和 标签tag 呢-icode9专业技术文章分享
- 2024-07-26SendGrid 对邮件的类别(Categories)和标签的数量有限制吗?-icode9专业技术文章分享
- 2024-07-17课程推荐《高性能GO企业级APM监控系统实战》
- 2024-06-26解决google chrome helper 内存占用较高!
- 2024-04-01got an unexpected keyword argument