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.
Lunny Xiao af459469e0 Add more tests about any (#64) преди 1 месец
public fix static compitable when prefix is / преди 2 години
.drone.yml new format drone (#60) преди 3 месеца
.gitignore Safe parse form and remove unnecessary parse on query (#63) преди 2 месеца
LICENSE license & small optimization преди 4 години
README.md fix README (#59) преди 5 месеца
README_CN.md remove unused file and correct README преди 3 месеца
RELEASE.md docs преди 4 години
compress.go lint fixed преди 2 години
compress_test.go license & small optimization преди 4 години
context.go add SetRequest for Context (#53) преди 7 месеца
context_test.go new format drone (#60) преди 3 месеца
cookie.go update cookie (#44) преди 2 години
cookie_test.go lint fixed преди 2 години
doc.go update README (#56) преди 6 месеца
error.go Add query functions and upgrade circleci to 2 (#51) преди 10 месеца
error_test.go license & small optimization преди 4 години
file.go Add Content to serve a file from http.FileSystem (#62) преди 3 месеца
file_test.go Add Content to serve a file from http.FileSystem (#62) преди 3 месеца
form.go Safe parse form and remove unnecessary parse on query (#63) преди 2 месеца
form_test.go Add FormTrimmed (#61) преди 3 месеца
go.mod use new package name (#55) преди 6 месеца
go.sum change log location преди 8 месеца
group.go add handlers support on group method (#54) преди 6 месеца
group_test.go add handlers support on group method (#54) преди 6 месеца
handler_test.go bug fixed for second group преди 1 година
logger.go change log location преди 8 месеца
logger_test.go change log location преди 8 месеца
logo.png add logo преди 5 години
param.go lint fixed преди 2 години
param_test.go added IsAjax and RemoteAddr for context, gofmt преди 4 години
pool.go pool size support disabled when is zero преди 1 година
pool_test.go license & small optimization преди 4 години
prefix.go lint fixed преди 2 години
prefix_test.go license & small optimization преди 4 години
query.go Safe parse form and remove unnecessary parse on query (#63) преди 2 месеца
query_test.go Add query functions and upgrade circleci to 2 (#51) преди 10 месеца
recovery.go lint fixed преди 2 години
recovery_test.go license & small optimization преди 4 години
response.go some docs & small improvements преди 4 години
return.go add errorwithcode interface преди 2 години
return_test.go add more tests (#58) преди 6 месеца
router.go lint fixed преди 2 години
router_test.go Add more tests about any (#64) преди 1 месец
static.go fix bug преди 1 година
static_test.go fix static compitable when prefix is / преди 2 години
tan.go Merge branch 'master' of https://github.com/lunny/tango преди 1 година
tan_test.go license & small optimization преди 4 години

README.md

Tango 简体中文

Build Status

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 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:

Documentation

Discuss

Cases

License

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