Product Promotion
0x5a.live
for different kinds of informations and explorations.
GitHub - lunny/tango: This is only a mirror and Moved to https://gitea.com/lunny/tango
This is only a mirror and Moved to https://gitea.com/lunny/tango - lunny/tango
Visit SiteGitHub - lunny/tango: This is only a mirror and Moved to https://gitea.com/lunny/tango
This is only a mirror and Moved to https://gitea.com/lunny/tango - lunny/tango
Powered by 0x5a.live 💗
Tango 简体中文
Package tango is a micro & pluggable web framework for Go.
Current version: v0.5.0 Version History
Getting Started
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
.
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 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
Documentation
- 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
Discuss
- Google Group - English
- QQ Group - 简体中文 #369240307
Cases
- 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
License
This project is under BSD License. See the LICENSE file for the full license text.
GoLang Resources
are all listed below.
Made with ❤️
to provide different kinds of informations and resources.