Golang的Web框架:handy

jopen 10年前

介绍

用 Go 实现的一个简单的 MVC 模式框架,目前支持:

  • 路由/RESTFUL(route)
  • 控制器(handler)
  • 视图(templates)
  • 表单(form)
  • 静态文件(static)

安装

请确保Go环境已经安装,如未安装请参考 Go 环境安装,请安装最新版。

go get github.com/go-web-framework/handy 

使用

package main    import (      "github.com/go-web-framework/handy"  )    var (      application = &handy.Application{}  )    func main() {      app := application.New(nil)      app.Route.Handle("/", func() string {          return "hello world!"      })      app.Route.Handle("/hello/{val}", func(val string) string {          return "hello " + val      })      app.Route.Handle("/hi/{val}", func(ctx *handy.Context, val string) {          ctx.WriteString("hi " + val)      })      app.Start()  }

启动程序访问8080端口,默认端口为8080

项目主页:http://www.open-open.com/lib/view/home/1386813821111