Skip to content
This repository was archived by the owner on Feb 3, 2021. It is now read-only.

lunny/tango

Folders and files

NameName
Last commit message
Last commit date

Latest commit

2ae1713 · May 17, 2019
Jan 25, 2019
May 17, 2017
May 12, 2016
Apr 28, 2015
Jul 29, 2017
Aug 3, 2017
Mar 21, 2015
Mar 7, 2017
Apr 28, 2015
Apr 29, 2019
Jun 1, 2017
Aug 28, 2017
Mar 7, 2017
Apr 28, 2015
Jan 25, 2019
Apr 28, 2015
Mar 7, 2017
May 17, 2017
Jan 25, 2019
Jan 25, 2019
Mar 22, 2019
Mar 22, 2019
May 17, 2019
May 17, 2019
Apr 12, 2018
Mar 22, 2019
Mar 22, 2019
Dec 25, 2014
Mar 7, 2017
Oct 26, 2015
Jan 4, 2018
Apr 28, 2015
Mar 7, 2017
Apr 28, 2015
Jan 25, 2019
Jan 25, 2019
Mar 7, 2017
Apr 28, 2015
May 4, 2015
Aug 29, 2017
Aug 29, 2017
Mar 7, 2017
Oct 9, 2016
Sep 15, 2018
May 17, 2017
Apr 12, 2018
Apr 28, 2015

Repository files navigation

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.