|
1 月之前 | |
---|---|---|
public | 2 年之前 | |
.drone.yml | 4 月之前 | |
.gitignore | 2 月之前 | |
LICENSE | 4 年之前 | |
README.md | 5 月之前 | |
README_CN.md | 4 月之前 | |
RELEASE.md | 4 年之前 | |
compress.go | 2 年之前 | |
compress_test.go | 4 年之前 | |
context.go | 7 月之前 | |
context_test.go | 4 月之前 | |
cookie.go | 2 年之前 | |
cookie_test.go | 2 年之前 | |
doc.go | 7 月之前 | |
error.go | 10 月之前 | |
error_test.go | 4 年之前 | |
file.go | 3 月之前 | |
file_test.go | 3 月之前 | |
form.go | 2 月之前 | |
form_test.go | 3 月之前 | |
go.mod | 7 月之前 | |
go.sum | 8 月之前 | |
group.go | 7 月之前 | |
group_test.go | 7 月之前 | |
handler_test.go | 1 年之前 | |
logger.go | 8 月之前 | |
logger_test.go | 8 月之前 | |
logo.png | 5 年之前 | |
param.go | 2 年之前 | |
param_test.go | 4 年之前 | |
pool.go | 1 年之前 | |
pool_test.go | 4 年之前 | |
prefix.go | 2 年之前 | |
prefix_test.go | 4 年之前 | |
query.go | 2 月之前 | |
query_test.go | 10 月之前 | |
recovery.go | 2 年之前 | |
recovery_test.go | 4 年之前 | |
response.go | 4 年之前 | |
return.go | 2 年之前 | |
return_test.go | 6 月之前 | |
router.go | 2 年之前 | |
router_test.go | 1 月之前 | |
static.go | 1 年之前 | |
static_test.go | 2 年之前 | |
tan.go | 1 年之前 | |
tan_test.go | 4 年之前 |
Package tango is a micro & pluggable web framework for Go.
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
.
Middlewares allow you easily plugin features for your Tango applications.
There are already many middlewares to simplify your work:
This project is under BSD License. See the LICENSE file for the full license text.