ThinkGo v0.1.0 发布了,一个轻量级的 Go 语言 MVC 框架

栏目: 软件资讯 · 发布时间: 6年前

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

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

  • 路由前缀、路由分组

  • 路由中间件

项目地址

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

Gitee:https://gitee.com/thinkgo/thinkgo


以上所述就是小编给大家介绍的《ThinkGo v0.1.0 发布了,一个轻量级的 Go 语言 MVC 框架》,希望对大家有所帮助,如果大家有任何疑问请给我留言,小编会及时回复大家的。在此也非常感谢大家对 码农网 的支持!

查看所有标签

猜你喜欢:

本站部分资源来源于网络,本站转载出于传递更多信息之目的,版权归原作者或者来源机构所有,如转载稿涉及版权问题,请联系我们

Cypherpunks

Cypherpunks

Julian Assange、Jacob Appelbaum、Andy Müller-Maguhn、Jérémie Zimmermann / OR Books / 2012-11 / GBP 8.99

Cypherpunks are activists who advocate the widespread use of strong cryptography (writing in code) as a route to progressive change. Julian Assange, the editor-in-chief of and visionary behind WikiLea......一起来看看 《Cypherpunks》 这本书的介绍吧!

RGB转16进制工具
RGB转16进制工具

RGB HEX 互转工具

图片转BASE64编码
图片转BASE64编码

在线图片转Base64编码工具

XML、JSON 在线转换
XML、JSON 在线转换

在线XML、JSON转换工具