网络编程
位置:首页>> 网络编程>> Go语言>> golang beego框架环境搭建过程

golang beego框架环境搭建过程

作者:Jeff的技术栈  发布时间:2024-02-13 03:29:39 

标签:golang,beego,环境搭建

环境搭建

下载安 * eego,bee

1.开启gomod设置代理

go env -w GO111MODULE=on
go env -w GOPROXY=https://goproxy.cn

2.安 * eego和bee

go get -u -v github.com/astaxie/beego
go get -u -v github.com/beego/bee

3.升级bee

bee update

4.zsh: command not found: bee

GOPATH/bin下的bee.exe 拷贝到 GOROOT/bin里面,也就是你的go语言环境变量的bin里面,然后运行 bee

5.bee相关命令

bee new name  //创建项目
bee version  //打印当前的Bee版本
bee migrate  //运行数据库迁移
bee api name //创建一个BeegoAPI应用程序
bee run //项目编译,项目启动
bee pack //在项目目录下执行,将项目打包zip包
bee generate //该命令自动化生成代码
bee dockerize. // 生成dockerfile文件实现应用docer化
bee bale //将非go文件转换为go源文件
bee fix //通过使应用程序与更新版本的Beego兼容来修复应用程序
bee pro //源码生成器
bee update. //更新bee

6.项目启动

进入项目目录 执行 bee run 命令,在浏览器输入网址:127.0.0.1:8080,显示如下:


golang beego框架环境搭建过程


7.beego项目结构分析


quickstart   //项目名称
|-- conf     //项目有关的配置文件夹
| |--app.conf
|-- controllers       //主要的业务代码
| |--default.go
|-- models //存放的是数据库有关内容
|-- routers //存放路由文件
| |-- router.go
|-- static//存放静态资源
| |-- css
| |-- img
| |-- js
|-- tests //测试文件
| |-- default_test.go
|-- views //视图文件
|-- index.tpl
|-- main.go

来源:https://www.cnblogs.com/guyouyin123/p/14026275.html

0
投稿

猜你喜欢

手机版 网络编程 asp之家 www.aspxhome.com