ThinkGo v0.1.0 釋出了,一個輕量級的 Go 語言 MVC 框架
ThinkGo
ThinkGo 是一個輕量級的Go語言MVC框架,目前支援路由 、中介軟體 、控制器 、請求 、響應 、Session 、檢視 、日誌 等web框架應該具備的基本功能,致力於讓程式碼簡潔、富於表達力,幫助開發者快速構建一個Web應用。
安裝
go get -u github.com/thinkoner/thinkgo
快速開始
package main import ( "github.com/thinkoner/thinkgo" "fmt" "github.com/thinkoner/thinkgo/router" "github.com/thinkoner/thinkgo/context" ) func main() { app := thinkgo.BootStrap() app.RegisterRoute(func(route *router.Route) { route.Get("/", func(req *context.Request) *context.Response { return thinkgo.Text("Hello ThinkGo !") }) route.Get("/ping", func(req *context.Request) *context.Response { return thinkgo.Json(map[string]string{ "message": "pong", }) }) // Dependency injection route.Get("/user/{name}", func(req *context.Request, name string) *context.Response { return thinkgo.Text(fmt.Sprintf("Hello %s !", name)) }) }) // listen and serve on 0.0.0.0:9011 app.Run() }
更新記錄
詳細版本釋出資訊:https://github.com/thinkoner/thinkgo/releases
-
路由字首、路由分組
-
路由中介軟體