beego框架 golang web框架-网上花店
beego网上花店功能介绍
主页 商品列表展示 商品详情 用户登录注册 购买 购物车 评价 用户中心 订单列表
后台管理页 商品管理 添加修改删除商品 用户管理 添加删除用户
网上花店功能比较简单 适合刚接触beego的初学者
使用技术
-
beego框架
-
Mysql数据库
-
html前端
-
js框架bootstrap
功能展示
beego初时化
main.go
package main
import (
_ "flower/routers"
"github.com/astaxie/beego"
)
func main() {
beego.Run()
}
beego路由
package routers
import (
"flower/controllers"
"github.com/astaxie/beego"
)
func init() {
beego.Router("/login", &controllers.LoginController{}) //使用基础路由
beego.Router("/", &controllers.MainController{})
beego.Router("/home_search", &controllers.Home_searchController{})
beego.Router("/gouwuche", &controllers.ShopcarController{})
beego.Router("/gouwuche/del", &controllers.ShopcarController{}, "post:Del")
beego.Router("/regist", &controllers.RegistController{})
beego.Router("/warning", &controllers.WarningController{})
beego.Router("/user_warning", &controllers.User_warningController{})
beego.Router("/commodity/:id", &controllers.CommodityController{})
beego.Router("/user", &controllers.UserController{})
beego.Router("/order", &controllers.OrderController{})
beego.Router("/tuijian", &controllers.TuijianController{})
beego.Router("/root", &controllers.RootController{})
beego.Router("/manage", &controllers.Manage_comController{})
beego.Router("/manage_com/add", &controllers.Manage_comController{}, "post:Add")
beego.Router("/manage_com/upd", &controllers.Manage_comController{}, "post:Upd")
beego.Router("/manage_com/del", &controllers.Manage_comController{}, "post:Del")
beego.Router("/manage_user", &controllers.Manage_userController{})
beego.Router("/manage_user/add", &controllers.Manage_userController{}, "post:Add")
//beego.Router("/manage_user/upd", &controllers.Manage_userController{}, "post:Upd")
beego.Router("/manage_user/del", &controllers.Manage_userController{}, "post:Del")
}
运行
创建数据库, 然后修改数据库连接相关信息。
go mod init
bee run
访问: http://127.0.0.1:8080/
标签:web,beego,框架,花店,manage,controllers,Router,post,Manage From: https://blog.51cto.com/beyondyinjl/8238937