Micro & pluggable web framework for Go
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.
 
The Gitter Badger 803012c8b4 Added Gitter badge 4 年之前
public added more tests 5 年之前
LICENSE license & small optimization 5 年之前
README.md Added Gitter badge 4 年之前
README_CN.md Update README_CN.md 5 年之前
RELEASE.md docs 5 年之前
compress.go license & small optimization 5 年之前
compress_test.go license & small optimization 5 年之前
context.go add default charset for json & xml 4 年之前
context_test.go add utf8 on tests and codes 4 年之前
cookie.go more useful param, form and cookie methods for context 5 年之前
cookie_test.go more useful param, form and cookie methods for context 5 年之前
doc.go license & small optimization 5 年之前
error.go license & small optimization 5 年之前
error_test.go license & small optimization 5 年之前
file.go license & small optimization 5 年之前
file_test.go license & small optimization 5 年之前
form.go more useful param, form and cookie methods for context 5 年之前
form_test.go more useful param, form and cookie methods for context 5 年之前
group.go small optimization 5 年之前
group_test.go license & small optimization 5 年之前
logger.go some docs & small improvements 5 年之前
logger_test.go license & small optimization 5 年之前
logo.png add logo 5 年之前
param.go more useful param, form and cookie methods for context 5 年之前
param_test.go more useful param, form and cookie methods for context 5 年之前
pool.go license & small optimization 5 年之前
pool_test.go license & small optimization 5 年之前
prefix.go small optimization 5 年之前
prefix_test.go license & small optimization 5 年之前
recovery.go license & small optimization 5 年之前
recovery_test.go license & small optimization 5 年之前
response.go some docs & small improvements 5 年之前
return.go add utf8 on tests and codes 4 年之前
return_test.go add return status code support and resolved #12 5 年之前
router.go better infomation on panic at add router 5 年之前
router_test.go license & small optimization 5 年之前
static.go add utf8 on tests and codes 4 年之前
static_test.go license & small optimization 5 年之前
tan.go add default charset for json & xml 4 年之前
tan_test.go license & small optimization 5 年之前

README.md

Tango Build Status 简体中文

Join the chat at https://gitter.im/lunny/tango

Tango Logo

Package tango is a micro & pluggable web framework for Go.

Current version: v0.4.6 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:

Getting Help

Cases

License

This project is under BSD License. See the LICENSE file for the full license text.