You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
3 years ago | |
---|---|---|
chapter-01 | 3 years ago | |
chapter-02 | 3 years ago | |
chapter-03 | 7 years ago | |
chapter-04 | 7 years ago | |
chapter-05 | 3 years ago | |
chapter-06 | 7 years ago | |
chapter-07 | 5 years ago | |
chapter-08 | 7 years ago | |
chapter-09 | 3 years ago | |
chapter-10 | 3 years ago | |
chapter-11 | 3 years ago | |
chapter-12 | 3 years ago | |
chapter-13 | 3 years ago | |
chapter-14 | 3 years ago | |
chapter-15 | 3 years ago | |
chapter-16 | 3 years ago | |
chapter-17 | 3 years ago | |
chapter-18 | 3 years ago | |
chapter-19 | 3 years ago | |
chapter-20 | 7 years ago | |
chapter-21 | 7 years ago | |
chapter-22 | 7 years ago | |
.gitignore | 7 years ago | |
README.md | 3 years ago | |
SUMMARY.md | 3 years ago | |
book.json | 7 years ago | |
logo.png | 7 years ago |
README.md
Tango
Tango is a micro & pluggable web framework for Go.
Current version: v0.6.2 Version History
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
- 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
- cache -
cache middleware - cache-memory, cache-file, cache-ledis, cache-nodb, cache-mysql, cache-postgres, cache-memcache, cache-redis
Getting Help
Cases
- 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.