You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
1 year ago | |
---|---|---|
public | 6 years ago | |
.drone.yml | 2 years ago | |
.gitignore | 3 years ago | |
LICENSE | 8 years ago | |
README.md | 2 years ago | |
README_CN.md | 2 years ago | |
RELEASE.md | 8 years ago | |
compress.go | 6 years ago | |
compress_test.go | 8 years ago | |
context.go | 2 years ago | |
context_test.go | 2 years ago | |
cookie.go | 6 years ago | |
cookie_test.go | 6 years ago | |
doc.go | 4 years ago | |
error.go | 4 years ago | |
error_test.go | 8 years ago | |
file.go | 3 years ago | |
file_test.go | 3 years ago | |
form.go | 1 year ago | |
form_test.go | 3 years ago | |
go.mod | 4 years ago | |
go.sum | 4 years ago | |
group.go | 4 years ago | |
group_test.go | 4 years ago | |
handler_test.go | 5 years ago | |
logger.go | 4 years ago | |
logger_test.go | 4 years ago | |
logo.png | 8 years ago | |
param.go | 6 years ago | |
param_test.go | 7 years ago | |
pool.go | 5 years ago | |
pool_test.go | 8 years ago | |
prefix.go | 6 years ago | |
prefix_test.go | 8 years ago | |
query.go | 3 years ago | |
query_test.go | 4 years ago | |
recovery.go | 6 years ago | |
recovery_test.go | 8 years ago | |
response.go | 8 years ago | |
return.go | 6 years ago | |
return_test.go | 4 years ago | |
router.go | 2 years ago | |
router_test.go | 3 years ago | |
static.go | 3 years ago | |
static_test.go | 6 years ago | |
tan.go | 2 years ago | |
tan_test.go | 2 years ago |
README.md
Tango 简体中文
Package tango is a micro & pluggable web framework for Go.
Getting Started
To install Tango:
go get gitea.com/lunny/tango
A classic usage of Tango below:
package main
import (
"errors"
"gitea.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 gitea.com/tango/manual-en-US
- 操作手册,您也可以访问 gitea.com/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 - gitea
- 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.