goft
搜索文档…
最简单的启动代码
https://创建一个main.go
xn--main-k84fui75wfy1a.go
1
package main
2
3
import (
4
"github.com/gin-gonic/gin"
5
"github.com/shenyisyn/goft-gin/goft"
6
)
7
type IndexController struct {}
8
func NewIndexController() *IndexController {
9
return &IndexController{}
10
}
11
func(this *IndexController) Index(ctx *gin.Context) string {
12
return "this is 首页"
13
}
14
func(this *IndexController) Name () string {
15
return "IndexController"
16
}
17
func(this *IndexController) Build(goft *goft.Goft){
18
goft.Handle("GET","/",this.Index)
19
}
20
func main() {
21
goft.Ignite(). //初始化脚手架
22
Mount("",NewIndexController()). //挂载控制器
23
Launch() //启动 默认8080
24
}
25
Copied!
最近更新 1yr ago
复制链接