1. package main
    2. import (
    3. "github.com/gin-gonic/gin"
    4. "github.com/shenyisyn/goft-gin/goft"
    5. )
    6. type IndexController struct {}
    7. func NewIndexController() *IndexController {
    8. return &IndexController{}
    9. }
    10. func(this *IndexController) Index(ctx *gin.Context) string {
    11. return "this is 首页"
    12. }
    13. func(this *IndexController) Name () string {
    14. return "IndexController"
    15. }
    16. func(this *IndexController) Build(goft *goft.Goft){
    17. goft.Handle("GET","/",this.Index)
    18. }
    19. func main() {
    20. goft.Ignite(). //初始化脚手架
    21. Mount("",NewIndexController()). //挂载控制器
    22. Launch() //启动 默认8080
    23. }