Tango manual
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.
 
Lunny Xiao 463f03717d
fix link
3 years ago
chapter-01 update import path 3 years ago
chapter-02 Change to new gitea address 3 years ago
chapter-03 init 7 years ago
chapter-04 init 7 years ago
chapter-05 fix link 3 years ago
chapter-06 init 7 years ago
chapter-07 change Json to JSON since Json deprecated 5 years ago
chapter-08 init 7 years ago
chapter-09 update import path 3 years ago
chapter-10 Change to new gitea address 3 years ago
chapter-11 Change to new gitea address 3 years ago
chapter-12 Change to new gitea address 3 years ago
chapter-13 Change to new gitea address 3 years ago
chapter-14 Change to new gitea address 3 years ago
chapter-15 Change to new gitea address 3 years ago
chapter-16 Change to new gitea address 3 years ago
chapter-17 Change to new gitea address 3 years ago
chapter-18 Change to new gitea address 3 years ago
chapter-19 Change to new gitea address 3 years ago
chapter-20 init 7 years ago
chapter-21 init 7 years ago
chapter-22 init 7 years ago
.gitignore init 7 years ago
README.md update import path 3 years ago
SUMMARY.md update import path 3 years ago
book.json init 7 years ago
logo.png init 7 years ago

README.md

Tango

Tango is a micro & pluggable web framework for Go.

Current version: v0.6.2 Version History

Getting Started

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.

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.