https://github.com/lunny/tango
This is only a mirror and Moved to https://gitea.com/lunny/tango
https://github.com/lunny/tango
golang middleware webframework
Last synced: 4 months ago
JSON representation
This is only a mirror and Moved to https://gitea.com/lunny/tango
- Host: GitHub
- URL: https://github.com/lunny/tango
- Owner: lunny
- License: mit
- Archived: true
- Created: 2014-12-17T03:07:09.000Z (about 10 years ago)
- Default Branch: master
- Last Pushed: 2019-05-17T03:31:14.000Z (almost 6 years ago)
- Last Synced: 2024-10-25T05:26:16.068Z (4 months ago)
- Topics: golang, middleware, webframework
- Language: Go
- Homepage:
- Size: 358 KB
- Stars: 832
- Watchers: 75
- Forks: 109
- Open Issues: 9
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- favorite-link - Go 的微型和可插拔 Web 框架。
- awesome-go - tango - Micro & pluggable web framework for Go - ★ 741 (Web Frameworks)
- awesome-go-extra - ARCHIVED - 12-17T03:07:09Z|2019-05-17T03:31:14Z| (Web Frameworks / Fail injection)
README
Tango [简体中文](README_CN.md)
=======================[](https://circleci.com/gh/lunny/tango) [](https://codecov.io/gh/lunny/tango)
[](https://goreportcard.com/report/github.com/lunny/tango)
[](https://discord.gg/7Ckxjwu)
Package tango is a micro & pluggable web framework for Go.
##### Current version: v0.5.0 [Version History](https://github.com/lunny/tango/releases)
## Getting Started
To install Tango:
go get github.com/lunny/tango
A classic usage of Tango below:
```go
package mainimport (
"errors"
"github.com/lunny/tango"
)type Action struct {
tango.JSON
}func (Action) Get() interface{} {
if true {
return map[string]string{
"say": "Hello tango!",
}
}
return errors.New("something error")
}func main() {
t := tango.Classic()
t.Get("/", new(Action))
t.Run()
}
```Then visit `http://localhost:8000` on your browser. You will get
```
{"say":"Hello tango!"}
```If you change `true` after `if` to `false`, then you will get
```
{"err":"something error"}
```This code will automatically convert returned map or error to a json because we has an embedded struct `tango.JSON`.
## Features
- Powerful routing & Flexible routes combinations.
- Directly integrate with existing services.
- Easy to plugin features with modular design.
- High performance dependency injection embedded.## Middlewares
Middlewares allow you easily plugin features for your Tango applications.
There are already many [middlewares](https://github.com/tango-contrib) to simplify your work:
- [recovery](https://github.com/lunny/tango/wiki/Recovery) - recover after panic
- [compress](https://github.com/lunny/tango/wiki/Compress) - Gzip & Deflate compression
- [static](https://github.com/lunny/tango/wiki/Static) - Serves static files
- [logger](https://github.com/lunny/tango/wiki/Logger) - Log the request & inject Logger to action struct
- [param](https://github.com/lunny/tango/wiki/Params) - get the router parameters
- [return](https://github.com/lunny/tango/wiki/Return) - Handle the returned value smartlly
- [context](https://github.com/lunny/tango/wiki/Context) - Inject context to action struct
- [session](https://github.com/tango-contrib/session) - [](https://circleci.com/gh/tango-contrib/session/tree/master) [](https://codecov.io/gh/tango-contrib/session) Session manager, [session-redis](http://github.com/tango-contrib/session-redis), [session-nodb](http://github.com/tango-contrib/session-nodb), [session-ledis](http://github.com/tango-contrib/session-ledis), [session-ssdb](http://github.com/tango-contrib/session-ssdb)
- [xsrf](https://github.com/tango-contrib/xsrf) - [](https://circleci.com/gh/tango-contrib/xsrf/tree/master) [](https://codecov.io/gh/tango-contrib/xsrf) Generates and validates csrf tokens
- [binding](https://github.com/tango-contrib/binding) - [](https://circleci.com/gh/tango-contrib/binding/tree/master) [](https://codecov.io/gh/tango-contrib/binding) Bind and validates forms
- [renders](https://github.com/tango-contrib/renders) - [](https://circleci.com/gh/tango-contrib/renders/tree/master) [](https://codecov.io/gh/tango-contrib/renders) Go template engine
- [dispatch](https://github.com/tango-contrib/dispatch) - [](https://circleci.com/gh/tango-contrib/dispatch/tree/master) [](https://codecov.io/gh/tango-contrib/dispatch) Multiple Application support on one server
- [tpongo2](https://github.com/tango-contrib/tpongo2) - [](https://circleci.com/gh/tango-contrib/tpongo2/tree/master) [](https://codecov.io/gh/tango-contrib/tpongo2) [Pongo2](https://github.com/flosch/pongo2) teamplte engine support
- [captcha](https://github.com/tango-contrib/captcha) - [](https://circleci.com/gh/tango-contrib/captcha/tree/master) [](https://codecov.io/gh/tango-contrib/captcha) Captcha
- [events](https://github.com/tango-contrib/events) - [](https://circleci.com/gh/tango-contrib/events/tree/master) [](https://codecov.io/gh/tango-contrib/events) Before and After
- [flash](https://github.com/tango-contrib/flash) - [](https://circleci.com/gh/tango-contrib/flash/tree/master) [](https://codecov.io/gh/tango-contrib/flash) Share data between requests
- [debug](https://github.com/tango-contrib/debug) - [](https://circleci.com/gh/tango-contrib/debug/tree/master) [](https://codecov.io/gh/tango-contrib/debug) show detail debug infomaton on log
- [basicauth](https://github.com/tango-contrib/basicauth) - [](https://circleci.com/gh/tango-contrib/basicauth/tree/master) [](https://codecov.io/gh/tango-contrib/basicauth) basicauth middleware
- [authz](https://github.com/tango-contrib/authz) - [](https://travis-ci.org/tango-contrib/authz) [](https://coveralls.io/github/tango-contrib/authz?branch=master) manage permissions via ACL, RBAC, ABAC
- [cache](https://github.com/tango-contrib/cache) - [](https://circleci.com/gh/tango-contrib/cache/tree/master) [](https://codecov.io/gh/tango-contrib/cache) cache middleware - cache-memory, cache-file, [cache-ledis](https://github.com/tango-contrib/cache-ledis), [cache-nodb](https://github.com/tango-contrib/cache-nodb), [cache-mysql](https://github.com/tango-contrib/cache-mysql), [cache-postgres](https://github.com/tango-contrib/cache-postgres), [cache-memcache](https://github.com/tango-contrib/cache-memcache), [cache-redis](https://github.com/tango-contrib/cache-redis)
- [rbac](https://github.com/tango-contrib/rbac) - [](https://circleci.com/gh/tango-contrib/rbac/tree/master) [](https://codecov.io/gh/tango-contrib/rbac) rbac control## Documentation
- [Manual](http://gobook.io/read/github.com/go-tango/manual-en-US/), And you are welcome to contribue for the book by git PR to [github.com/go-tango/manual-en-US](https://github.com/go-tango/manual-en-US)
- [操作手册](http://gobook.io/read/github.com/go-tango/manual-zh-CN/),您也可以访问 [github.com/go-tango/manual-zh-CN](https://github.com/go-tango/manual-zh-CN)为本手册进行贡献
- [API Reference](https://gowalker.org/github.com/lunny/tango)## Discuss
- [Google Group - English](https://groups.google.com/forum/#!forum/go-tango)
- QQ Group - 简体中文 #369240307## Cases
- [GopherTC](https://github.com/jimmykuu/gopher/tree/2.0) - China Discuss Forum
- [Wego](https://github.com/go-tango/wego) - Discuss Forum
- [dbweb](https://github.com/go-xorm/dbweb) - DB management web UI
- [Godaily](http://godaily.org) - [github](https://github.com/godaily/news)
- [Pugo](https://github.com/go-xiaohei/pugo) - A pugo blog
- [Gos](https://github.com/go-tango/gos) - Static web server
- [GoFtpd](https://github.com/goftp/ftpd) - Pure Go cross-platform ftp server## License
This project is under BSD License. See the [LICENSE](LICENSE) file for the full license text.