Micro & pluggable web framework for Go
Não pode escolher mais do que 25 tópicos Os tópicos devem começar com uma letra ou um número, podem incluir traços ('-') e podem ter até 35 caracteres.
Lunny Xiao b786e0bcf4
Fix up to parent directory
há 3 meses
public fix static compitable when prefix is / há 3 anos
.drone.yml new format drone (#60) há 11 meses
.gitignore Safe parse form and remove unnecessary parse on query (#63) há 9 meses
LICENSE license & small optimization há 5 anos
README.md Update README há 3 meses
README_CN.md remove unused file and correct README há 11 meses
RELEASE.md docs há 5 anos
compress.go lint fixed há 3 anos
compress_test.go license & small optimization há 5 anos
context.go add SetRequest for Context (#53) há 1 ano
context_test.go More tests (#65) há 5 meses
cookie.go update cookie (#44) há 2 anos
cookie_test.go lint fixed há 3 anos
doc.go update README (#56) há 1 ano
error.go Add query functions and upgrade circleci to 2 (#51) há 1 ano
error_test.go license & small optimization há 5 anos
file.go Add Content to serve a file from http.FileSystem (#62) há 10 meses
file_test.go Add Content to serve a file from http.FileSystem (#62) há 10 meses
form.go Safe parse form and remove unnecessary parse on query (#63) há 9 meses
form_test.go Add FormTrimmed (#61) há 10 meses
go.mod use new package name (#55) há 1 ano
go.sum change log location há 1 ano
group.go add handlers support on group method (#54) há 1 ano
group_test.go add handlers support on group method (#54) há 1 ano
handler_test.go bug fixed for second group há 2 anos
logger.go change log location há 1 ano
logger_test.go change log location há 1 ano
logo.png add logo há 5 anos
param.go lint fixed há 3 anos
param_test.go added IsAjax and RemoteAddr for context, gofmt há 4 anos
pool.go pool size support disabled when is zero há 2 anos
pool_test.go license & small optimization há 5 anos
prefix.go lint fixed há 3 anos
prefix_test.go license & small optimization há 5 anos
query.go Safe parse form and remove unnecessary parse on query (#63) há 9 meses
query_test.go Add query functions and upgrade circleci to 2 (#51) há 1 ano
recovery.go lint fixed há 3 anos
recovery_test.go license & small optimization há 5 anos
response.go some docs & small improvements há 5 anos
return.go add errorwithcode interface há 2 anos
return_test.go add more tests (#58) há 1 ano
router.go lint fixed há 3 anos
router_test.go Add more tests about any (#64) há 8 meses
static.go Fix up to parent directory há 3 meses
static_test.go fix static compitable when prefix is / há 3 anos
tan.go Merge branch 'master' of https://github.com/lunny/tango há 2 anos
tan_test.go license & small optimization há 5 anos

README.md

Tango 简体中文

Build Status 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 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.