Micro & pluggable web framework for Go
Clone or download
Latest commit ff8395e Sep 15, 2018
Permalink
Failed to load latest commit information.
public fix static compitable when prefix is / May 17, 2017
.gitignore improved route middlewares support & bug fixed #29 May 12, 2016
LICENSE license & small optimization Apr 28, 2015
README.md remove wrong code Jul 29, 2017
README_CN.md add new case for Chinese Aug 3, 2017
RELEASE.md docs Mar 21, 2015
circle.yml update readme May 26, 2017
compress.go lint fixed Mar 7, 2017
compress_test.go license & small optimization Apr 28, 2015
context.go fix bug Jun 26, 2017
context_test.go add tests for ActionTag & ActionValue Jun 1, 2017
cookie.go update cookie (#44) Aug 28, 2017
cookie_test.go lint fixed Mar 7, 2017
doc.go license & small optimization Apr 28, 2015
error.go add errorwithcode interface Aug 29, 2017
error_test.go license & small optimization Apr 28, 2015
file.go lint fixed Mar 7, 2017
file_test.go fix static compitable when prefix is / May 17, 2017
form.go lint fixed Mar 7, 2017
form_test.go added IsAjax and RemoteAddr for context, gofmt Oct 26, 2015
group.go bug fixed for second group Apr 12, 2018
group_test.go improved group middlewares and added route middlewares support Mar 16, 2016
handler_test.go bug fixed for second group Apr 12, 2018
logger.go add composite logger Mar 9, 2017
logger_test.go add some tests May 31, 2017
logo.png add logo Dec 25, 2014
param.go lint fixed Mar 7, 2017
param_test.go added IsAjax and RemoteAddr for context, gofmt Oct 26, 2015
pool.go pool size support disabled when is zero Jan 4, 2018
pool_test.go license & small optimization Apr 28, 2015
prefix.go lint fixed Mar 7, 2017
prefix_test.go license & small optimization Apr 28, 2015
recovery.go lint fixed Mar 7, 2017
recovery_test.go license & small optimization Apr 28, 2015
response.go some docs & small improvements May 4, 2015
return.go add errorwithcode interface Aug 29, 2017
return_test.go add errorwithcode interface Aug 29, 2017
router.go lint fixed Mar 7, 2017
router_test.go bug fixed for router Oct 9, 2016
static.go fix bug Sep 15, 2018
static_test.go fix static compitable when prefix is / May 17, 2017
tan.go Merge branch 'master' of https://github.com/lunny/tango Apr 12, 2018
tan_test.go license & small optimization Apr 28, 2015

README.md

Tango 简体中文

CircleCI codecov Join the chat at https://img.shields.io/discord/323705316027924491.svg

Tango Logo

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

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

Documentation

Discuss

Cases

License

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