Micro & pluggable web framework for Go
Du kannst nicht mehr als 25 Themen auswählen Themen müssen entweder mit einem Buchstaben oder einer Ziffer beginnen. Sie können Bindestriche („-“) enthalten und bis zu 35 Zeichen lang sein.
Lunny Xiao af459469e0 Add more tests about any (#64) vor 1 Monat
public fix static compitable when prefix is / vor 2 Jahren
.drone.yml new format drone (#60) vor 3 Monaten
.gitignore Safe parse form and remove unnecessary parse on query (#63) vor 2 Monaten
LICENSE license & small optimization vor 4 Jahren
README.md fix README (#59) vor 5 Monaten
README_CN.md remove unused file and correct README vor 3 Monaten
RELEASE.md docs vor 4 Jahren
compress.go lint fixed vor 2 Jahren
compress_test.go license & small optimization vor 4 Jahren
context.go add SetRequest for Context (#53) vor 7 Monaten
context_test.go new format drone (#60) vor 3 Monaten
cookie.go update cookie (#44) vor 2 Jahren
cookie_test.go lint fixed vor 2 Jahren
doc.go update README (#56) vor 6 Monaten
error.go Add query functions and upgrade circleci to 2 (#51) vor 10 Monaten
error_test.go license & small optimization vor 4 Jahren
file.go Add Content to serve a file from http.FileSystem (#62) vor 3 Monaten
file_test.go Add Content to serve a file from http.FileSystem (#62) vor 3 Monaten
form.go Safe parse form and remove unnecessary parse on query (#63) vor 2 Monaten
form_test.go Add FormTrimmed (#61) vor 3 Monaten
go.mod use new package name (#55) vor 6 Monaten
go.sum change log location vor 8 Monaten
group.go add handlers support on group method (#54) vor 6 Monaten
group_test.go add handlers support on group method (#54) vor 6 Monaten
handler_test.go bug fixed for second group vor 1 Jahr
logger.go change log location vor 8 Monaten
logger_test.go change log location vor 8 Monaten
logo.png add logo vor 5 Jahren
param.go lint fixed vor 2 Jahren
param_test.go added IsAjax and RemoteAddr for context, gofmt vor 4 Jahren
pool.go pool size support disabled when is zero vor 1 Jahr
pool_test.go license & small optimization vor 4 Jahren
prefix.go lint fixed vor 2 Jahren
prefix_test.go license & small optimization vor 4 Jahren
query.go Safe parse form and remove unnecessary parse on query (#63) vor 2 Monaten
query_test.go Add query functions and upgrade circleci to 2 (#51) vor 10 Monaten
recovery.go lint fixed vor 2 Jahren
recovery_test.go license & small optimization vor 4 Jahren
response.go some docs & small improvements vor 4 Jahren
return.go add errorwithcode interface vor 2 Jahren
return_test.go add more tests (#58) vor 6 Monaten
router.go lint fixed vor 2 Jahren
router_test.go Add more tests about any (#64) vor 1 Monat
static.go fix bug vor 1 Jahr
static_test.go fix static compitable when prefix is / vor 2 Jahren
tan.go Merge branch 'master' of https://github.com/lunny/tango vor 1 Jahr
tan_test.go license & small optimization vor 4 Jahren

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.