1. //默认情况下路由和控制器是设置在一起的
    2. type IndexClass struct {
    3. }
    4. func NewIndexClass() *IndexClass {
    5. return &IndexClass{}
    6. }
    7. //这里就是设置路由的方法,必须有这个方法
    8. func (this *IndexClass) Build(goft *goft.Goft) {
    9. goft.HandleWithFairing("GET", "/",
    10. this.GetIndex, fairing.NewIndexFairing()).
    11. Handle("GET", "/users", this.TestUsers).
    12. Handle("GET", "/users/:id", this.TestUserDetail).
    13. Handle("GET", "/test", this.Test)
    14. }
    15. func (this *IndexClass) Name() string {
    16. return "IndexClass"
    17. }