Go 的全堆栈 Web 框架,Revel v0.11.3 发布

jopen 10年前

Revel 是 Go 语言的框架,其思路完全来自 Java 的 Play Framework。

控制器示例:

// app/controllers/app.go     type Application struct {      *rev.Controller  }     func (c Application) Register() rev.Result {      title := "Register"      return c.Render(title)  }     func (c Application) SaveUser(user models.User, verifyPassword string) rev.Result {      c.Validation.Required(verifyPassword).Key("verifyPassword")      c.Validation.Required(verifyPassword == user.Password).Key("verifyPassword").          Message("Password does not match")      user.Validate(c.Validation)         if c.Validation.HasErrors() {          c.Validation.Keep()          c.FlashParams()          return c.Redirect(Application.Register)      }         _, err := c.Txn.Exec("insert into User (Username, Password, Name) values (?, ?, ?)",          user.Username, user.Password, user.Name)      if err != nil {          panic(err)      }         c.Session["user"] = user.Username      c.Flash.Success("Welcome, " + user.Name)      return c.Redirect(Hotels.Index)  }

Revel v0.11.3 发布,此版本是个小的 bug 修复版本:修复了 Revel v0.11.2 一个关键的 bug (#824)。

强烈建议每位用户使用最新版本的 Revel 重建项目:

$ go get -u github.com/revel/cmd/revel     $ revel build github.com/myusername/myproject /path/to/destination/folder

此版本现已提供下载:

https://github.com/revel/revel/archive/v0.11.3.zip

https://github.com/revel/revel/archive/v0.11.3.tar.gz