最简单的启动代码

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
}

最后更新于