ThinkGo:一个轻量级的 Go 语言 MVC 框架

2019-02-14 13:22:33 +08:00
 techone

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

特性

安装

go get 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()
}

协议

ThinkGo 采用 Apache 2.0 开源协议发布。

项目地址

联系作者

https://github.com/thinkoner/thinkgo/issues

3608 次点击
所在节点    程序员
6 条回复
techone
2019-02-14 13:26:25 +08:00
快来吐槽
fnh
2019-02-14 13:34:33 +08:00
第 N 个叫 ThinkGo 的 GO 框架
tulongtou
2019-02-14 13:47:27 +08:00
ThinkPHP 他弟嘛
luob
2019-02-14 14:26:30 +08:00
先 star 一个,然后吐槽:
1. 用 go 语言写东西就是为了躲开全家桶的条条框框限制,老子想怎么写就怎么写,你可以提供一些小工具或者 typedef 原生库做一些渐进增强,写一个全家桶肯定要被很多人鄙视的,做好心理准备。
2. thinkXXX 这个系列的名字真的用烂了,改个名字防臭。
runningman
2019-02-14 19:02:23 +08:00
记得已经下载了 可否加微信聊 270115861
techone
2019-02-16 11:58:18 +08:00
最像 Laravel 的 Eloquent ORM 的 Go 版:ThinkORM
https://github.com/thinkoner/torm

这是一个专为移动设备优化的页面(即为了让你能够在 Google 搜索结果里秒开这个页面),如果你希望参与 V2EX 社区的讨论,你可以继续到 V2EX 上打开本讨论主题的完整版本。

https://www.v2ex.com/t/534896

V2EX 是创意工作者们的社区,是一个分享自己正在做的有趣事物、交流想法,可以遇见新朋友甚至新机会的地方。

V2EX is a community of developers, designers and creative people.

© 2021 V2EX