进入基础教程
# 新建 指定三张表
bee api pretty-admin -tables="sys_user,sys_role,sys_menu" -driver=mysql -conn="root:@tcp(127.0.0.1:3306)/test-cc"
# 新建 指定一张表
bee api pretty-admin -tables="sys_dict" -driver=mysql -conn="root:@tcp(127.0.0.1:3306)/test-cc"
# 先cd进入src目录,避免出现下面这句
You current workdir is not inside $GOPATH/src.
# 成功
22:55:49 SUCCESS ▶ 0010 New API successfully created!
# cd pretty-admin
# bee run之后的文档配置最好带上
bee run -gendoc=true -downdoc=true
报错了:
cannot find package "github.com/astaxie/beego" in any of:
加速
set GO111MODULE=on
go get github.com/astaxie/beego
又报错了:
cannot find main module
go mod init
out:go: creating new go.mod: module pretty/pretty-admin
SUCCESS ▶ 0007 './pretty-admin.exe' is running...
http server Running on http://:8080
如果调用失败,报404/403等,
检查routers目录是不是少个文件:commentsRouter_controllers.go
就重新执行bee api projectName;bee run -gendoc=true -downdoc=true,但是会重新创建目录
如果在原根目录创建相同名称的项目,系统会提示:
增加新表CRUD
现在有几张表的增删改查了,但是如果新增表会不会覆盖原代码呢