Micro & pluggable web framework for Go
Вы не можете выбрать более 25 тем Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.
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.