goft
搜索文档…
最简单的启动代码
https://创建一个main.go
xn--main-k84fui75wfy1a.go
package main
import (
"github.com/gin-gonic/gin"
"github.com/shenyisyn/goft-gin/goft"
)
type IndexController struct {}
func NewIndexController() *IndexController {
return &IndexController{}
}
func(this *IndexController) Index(ctx *gin.Context) string {
return "this is 首页"
}
func(this *IndexController) Name () string {
return "IndexController"
}
func(this *IndexController) Build(goft *goft.Goft){
goft.Handle("GET","/",this.Index)
}
func main() {
goft.Ignite(). //初始化脚手架
Mount("",NewIndexController()). //挂载控制器
Launch() //启动 默认8080
}
复制链接