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.
 
 
 
fud 70bfc05b5c rename ctx.RemoteAddr() to ctx.IP() 4 years ago
public added more tests 5 years ago
LICENSE license & small optimization 5 years ago
README.md Added Gitter badge 4 years ago
README_CN.md Update README_CN.md 4 years ago
RELEASE.md docs 5 years ago
compress.go license & small optimization 5 years ago
compress_test.go license & small optimization 5 years ago
context.go rename ctx.RemoteAddr() to ctx.IP() 4 years ago
context_test.go add utf8 on tests and codes 4 years ago
cookie.go added IsAjax and RemoteAddr for context, gofmt 4 years ago
cookie_test.go added IsAjax and RemoteAddr for context, gofmt 4 years ago
doc.go license & small optimization 5 years ago
error.go license & small optimization 5 years ago
error_test.go license & small optimization 5 years ago
file.go license & small optimization 5 years ago
file_test.go license & small optimization 5 years ago
form.go added IsAjax and RemoteAddr for context, gofmt 4 years ago
form_test.go added IsAjax and RemoteAddr for context, gofmt 4 years ago
group.go added IsAjax and RemoteAddr for context, gofmt 4 years ago
group_test.go license & small optimization 5 years ago
logger.go some docs & small improvements 5 years ago
logger_test.go license & small optimization 5 years ago
logo.png add logo 5 years ago
param.go added IsAjax and RemoteAddr for context, gofmt 4 years ago
param_test.go added IsAjax and RemoteAddr for context, gofmt 4 years ago
pool.go added IsAjax and RemoteAddr for context, gofmt 4 years ago
pool_test.go license & small optimization 5 years ago
prefix.go small optimization 5 years ago
prefix_test.go license & small optimization 5 years ago
recovery.go license & small optimization 5 years ago
recovery_test.go license & small optimization 5 years ago
response.go some docs & small improvements 5 years ago
return.go added IsAjax and RemoteAddr for context, gofmt 4 years ago
return_test.go added IsAjax and RemoteAddr for context, gofmt 4 years ago
router.go less memory for init 4 years ago
router_test.go added more test for routers 4 years ago
static.go add utf8 on tests and codes 4 years ago
static_test.go license & small optimization 5 years ago
tan.go added more test for routers 4 years ago
tan_test.go license & small optimization 5 years ago

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.