Tango 简体中文
Package tango is a micro & pluggable web framework for Go.
Current version: v0.5.0 Version History
To install Tango:
go get github.com/lunny/tango
A classic usage of Tango below:
package main
import (
"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
.
- Powerful routing & Flexible routes combinations.
- Directly integrate with existing services.
- Easy to plugin features with modular design.
- High performance dependency injection embedded.
Middlewares allow you easily plugin features for your Tango applications.
There are already many middlewares to simplify your work:
- 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
- context - Inject context to action struct
- session - Session manager, session-redis, session-nodb, session-ledis, session-ssdb
- xsrf - Generates and validates csrf tokens
- binding - Bind and validates forms
- renders - Go template engine
- dispatch - Multiple Application support on one server
- tpongo2 - Pongo2 teamplte engine support
- captcha - Captcha
- events - Before and After
- flash - Share data between requests
- debug - show detail debug infomaton on log
- basicauth - basicauth middleware
- authz - manage permissions via ACL, RBAC, ABAC
- cache - cache middleware - cache-memory, cache-file, cache-ledis, cache-nodb, cache-mysql, cache-postgres, cache-memcache, cache-redis
- rbac - rbac control
- Manual, And you are welcome to contribue for the book by git PR to github.com/go-tango/manual-en-US
- 操作手册,您也可以访问 github.com/go-tango/manual-zh-CN为本手册进行贡献
- API Reference
- Google Group - English
- QQ Group - 简体中文 #369240307
- GopherTC - China Discuss Forum
- Wego - Discuss Forum
- dbweb - DB management web UI
- Godaily - github
- Pugo - A pugo blog
- Gos - Static web server
- GoFtpd - Pure Go cross-platform ftp server
This project is under BSD License. See the LICENSE file for the full license text.