Micro & pluggable web framework for Go
Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.
Lunny Xiao af459469e0 Add more tests about any (#64) il y a 1 mois
public fix static compitable when prefix is / il y a 2 ans
.drone.yml new format drone (#60) il y a 4 mois
.gitignore Safe parse form and remove unnecessary parse on query (#63) il y a 2 mois
LICENSE license & small optimization il y a 4 ans
README.md fix README (#59) il y a 5 mois
README_CN.md remove unused file and correct README il y a 4 mois
RELEASE.md docs il y a 4 ans
compress.go lint fixed il y a 2 ans
compress_test.go license & small optimization il y a 4 ans
context.go add SetRequest for Context (#53) il y a 7 mois
context_test.go new format drone (#60) il y a 4 mois
cookie.go update cookie (#44) il y a 2 ans
cookie_test.go lint fixed il y a 2 ans
doc.go update README (#56) il y a 7 mois
error.go Add query functions and upgrade circleci to 2 (#51) il y a 10 mois
error_test.go license & small optimization il y a 4 ans
file.go Add Content to serve a file from http.FileSystem (#62) il y a 3 mois
file_test.go Add Content to serve a file from http.FileSystem (#62) il y a 3 mois
form.go Safe parse form and remove unnecessary parse on query (#63) il y a 2 mois
form_test.go Add FormTrimmed (#61) il y a 3 mois
go.mod use new package name (#55) il y a 7 mois
go.sum change log location il y a 8 mois
group.go add handlers support on group method (#54) il y a 7 mois
group_test.go add handlers support on group method (#54) il y a 7 mois
handler_test.go bug fixed for second group il y a 1 an
logger.go change log location il y a 8 mois
logger_test.go change log location il y a 8 mois
logo.png add logo il y a 5 ans
param.go lint fixed il y a 2 ans
param_test.go added IsAjax and RemoteAddr for context, gofmt il y a 4 ans
pool.go pool size support disabled when is zero il y a 1 an
pool_test.go license & small optimization il y a 4 ans
prefix.go lint fixed il y a 2 ans
prefix_test.go license & small optimization il y a 4 ans
query.go Safe parse form and remove unnecessary parse on query (#63) il y a 2 mois
query_test.go Add query functions and upgrade circleci to 2 (#51) il y a 10 mois
recovery.go lint fixed il y a 2 ans
recovery_test.go license & small optimization il y a 4 ans
response.go some docs & small improvements il y a 4 ans
return.go add errorwithcode interface il y a 2 ans
return_test.go add more tests (#58) il y a 6 mois
router.go lint fixed il y a 2 ans
router_test.go Add more tests about any (#64) il y a 1 mois
static.go fix bug il y a 1 an
static_test.go fix static compitable when prefix is / il y a 2 ans
tan.go Merge branch 'master' of https://github.com/lunny/tango il y a 1 an
tan_test.go license & small optimization il y a 4 ans

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.