1 Star 0 Fork 11

huzorro / tango

forked from lunny / tango 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
贡献代码
同步代码
取消
提示: 由于 Git 不支持空文件夾,创建文件夹后会生成空的 .keep 文件
Loading...
README
MIT

Tango Build Status English

Tango Logo

Tango 是一个微内核易扩展的Go语言Web框架.

当前版本: 0.2.8

简介

安装Tango:

go get github.com/lunny/tango

最简单的例子:

package main

import "github.com/lunny/tango"

func main() {
    t := tango.Classic()
    t.Get("/", func() string {
        return "Hello tango!"
    })
    t.Run()
}

然后在浏览器访问http://localhost:8000即可。当然了,tango其实对struct形式的支持更好。比如:

package main

import "github.com/lunny/tango"

type Action struct {
    tango.Json
}

func (Action) Get() map[string]string {
    return map[string]string{
        "say": "Hello tango!",
    }
}

func main() {
    t := tango.Classic()
    t.Get("/", new(Action))
    t.Run()
}

这段代码因为拥有一个内嵌的tango.Json,所以返回值会被自动的转成Json。具体返回可以参见以下文档。

源码文档 godocWiki

特性

  • 强大而灵活的路由设计
  • 兼容已有的http.Handler
  • 模块化设计,可以很容易写出自定义插件
  • 高性能的依赖注入方式

中间件

中间件让你像切面编程那样来操作你的Controller。

目前已有很多 中间件,可以帮助你来简化工作:

  • recovery - recover after panic
  • compress - Gzip & Deflate compression
  • static - Serves static files
  • logger - Log the request & inject Logger to action struct
  • param - get the router parameters
  • return - Handle the returned value smartlly
  • request - Inject request to action struct
  • response - Inject response to action struct
  • session - Build Status Session manager
  • xsrf - Build Status Generates and validates csrf tokens
  • binding - Build Status Bind and validates forms
  • renders - Build Status Go template engine
  • dispatch - Build Status Multiple Application support on one server
  • tpongo2 - Build Status Pongo2 teamplte engine support
  • captcha - Build Status Captcha
  • events - Build Status Before and After
  • flash - Build Status Share data between requests
  • debug - Build Status show detail debug infomaton on log

获得帮助

案例

讨论

QQ群:369240307

License

This project is under BSD License. See the LICENSE file for the full license text.

Copyright (c) 2014 lunny xiaolunwen@gmail.com Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

简介

微内核可扩展的Go语言Web框架 展开 收起
MIT
取消

发行版

暂无发行版

贡献者

全部

近期动态

加载更多
不能加载更多了
1
https://gitee.com/huzorro/tango.git
git@gitee.com:huzorro/tango.git
huzorro
tango
tango
master

搜索帮助