php框架 tp laravel,PHP 转 Go,用 Laravel、thinkphp 的用法造了一个 ThinkGo 框架

ThinkGo 是一个轻量级的 Go 语言 MVC 框架,目前支持路由、中间件、控制器、请求、响应、Session、视图、日志等 web 框架应该具备的基本功能,致力于让代码简洁、富于表达力,帮助开发者快速构建一个 Web 应用。

安装

go get -u github.com/forgoer/thinkgo

用法

package main

import (

"github.com/forgoer/thinkgo"

"fmt"

"github.com/forgoer/thinkgo/router"

"github.com/forgoer/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()

}

项目地址

大佬们来指点指点,贡献贡献代码。。。

你可能感兴趣的:(php框架,tp,laravel)