2. bee 工具简介
bee 工具是一个为了协助快速开发 beego 项目而创建的项目,通过 bee 您可以很容易的进行 beego 项目的创建、热编译、开发、测试、和部署。
2.1. bee 工具的安装
您可以通过如下的方式安装 bee 工具:
go get github.com/beego/bee
安装完之后,bee 可执行文件默认存放在 $GOPATH/bin 里面,所以您需要把 $GOPATH/bin 添加到您的环境变量中,才可以进行下一步。
如何添加环境变量,请自行搜索 如果你本机设置了
GOBIN,那么上面的命令就会安装到GOBIN下,请添加 GOBIN 到你的环境变量中
2.2. bee 工具命令详解
我们在命令行输入 bee,可以看到如下的信息:
Bee is a Fast and Flexible tool for managing your Beego Web Application.
Usage:
bee command [arguments]
The commands are:
version show the bee & beego version
migrate run database migrations
api create an api application base on beego framework
bale packs non-Go files to Go source files
new create an application base on beego framework
run run the app which can hot compile
pack compress an beego project
fix Fixes your application by making it compatible with newer versions of Beego
dlv Start a debugging session using Delve
dockerize Generates a Dockerfile for your Beego application
generate Source code generator
hprose Creates an RPC application based on Hprose and Beego frameworks
new Creates a Beego application
pack Compresses a Beego application into a single file
rs Run customized scripts
run Run the application by starting a local development server
server serving static content over HTTP on port
Use bee help [command] for more information about a command.
2.2.1. new 命令
new 命令是新建一个 Web 项目,我们在命令行下执行 bee new <项目名> 就可以创建一个新的项目。但是注意该命令必须在 $GOPATH/src 下执行。最后会在 $GOPATH/src 相应目录下生成如下目录结构的项目:
bee new myproject
[INFO] Creating application...
/gopath/src/myproject/
/gopath/src/myproject/conf/
/gopath/src/myproject/

最低0.47元/天 解锁文章
831

被折叠的 条评论
为什么被折叠?



