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 1750e262b4 add more tests (#58) 1 week ago
.circleci Add query functions and upgrade circleci to 2 (#51) 5 months ago
public fix static compitable when prefix is / 2 years ago
.drone.yml use droneci (#47) 1 month ago
.gitignore improved route middlewares support & bug fixed #29 3 years ago
LICENSE license & small optimization 4 years ago
README.md change cover service (#57) 1 month ago
README_CN.md change cover service (#57) 1 month ago
RELEASE.md docs 4 years ago
compress.go lint fixed 2 years ago
compress_test.go license & small optimization 4 years ago
context.go add SetRequest for Context (#53) 1 month ago
context_test.go add tests for ActionTag & ActionValue 2 years ago
cookie.go update cookie (#44) 1 year ago
cookie_test.go lint fixed 2 years ago
doc.go update README (#56) 1 month ago
error.go Add query functions and upgrade circleci to 2 (#51) 5 months ago
error_test.go license & small optimization 4 years ago
file.go lint fixed 2 years ago
file_test.go fix static compitable when prefix is / 2 years ago
form.go Add query functions and upgrade circleci to 2 (#51) 5 months ago
form_test.go Add query functions and upgrade circleci to 2 (#51) 5 months ago
go.mod use new package name (#55) 1 month ago
go.sum change log location 3 months ago
group.go add handlers support on group method (#54) 1 month ago
group_test.go add handlers support on group method (#54) 1 month ago
handler_test.go bug fixed for second group 1 year ago
logger.go change log location 3 months ago
logger_test.go change log location 3 months ago
logo.png add logo 4 years ago
param.go lint fixed 2 years ago
param_test.go added IsAjax and RemoteAddr for context, gofmt 3 years ago
pool.go pool size support disabled when is zero 1 year ago
pool_test.go license & small optimization 4 years ago
prefix.go lint fixed 2 years ago
prefix_test.go license & small optimization 4 years ago
query.go Add query functions and upgrade circleci to 2 (#51) 5 months ago
query_test.go Add query functions and upgrade circleci to 2 (#51) 5 months ago
recovery.go lint fixed 2 years ago
recovery_test.go license & small optimization 4 years ago
response.go some docs & small improvements 4 years ago
return.go add errorwithcode interface 1 year ago
return_test.go add more tests (#58) 1 week ago
router.go lint fixed 2 years ago
router_test.go bug fixed for router 2 years ago
static.go fix bug 9 months ago
static_test.go fix static compitable when prefix is / 2 years ago
tan.go Merge branch 'master' of https://github.com/lunny/tango 1 year ago
tan_test.go license & small optimization 4 years ago

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.