Her FrameworkGo MVC 模式框架
介紹
用 Go 實現(xiàn)的一個簡單的 MVC 模式框架,目前支持:
路由/RESTFUL(route)
控制器(handler)
視圖(templates)
表單(form)
靜態(tài)文件(static)
安裝
請確保Go環(huán)境已經(jīng)安裝,如未安裝請參考 Go 環(huán)境安裝,請安裝最新版。
go get github.com/go-code/her
使用
package main
import (
"github.com/go-code/her"
)
func main() {
app := her.NewApplication()
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 *her.Context, val string) {
ctx.WriteString("hi " + val)
})
app.Start()
}
啟動程序訪問8080端口,默認(rèn)端口為8080
參考、使用項目
開發(fā)成員
John, Monkey
評論
圖片
表情
