lunny 6e8b61153d 更新 'README_CN.md' 4 months ago
public added more tests 2 years ago
.gitignore improved route middlewares support & bug fixed #29 1 year ago
LICENSE license & small optimization 2 years ago
README.md 更新 'README.md' 4 months ago
README_CN.md 更新 'README_CN.md' 4 months ago
RELEASE.md docs 2 years ago
circle.yml add circle config file and put badges on README 1 year ago
compress.go lint fixed 10 months ago
compress_test.go license & small optimization 2 years ago
context.go lint fixed 10 months ago
context_test.go lint fixed 10 months ago
cookie.go lint fixed 10 months ago
cookie_test.go lint fixed 10 months ago
doc.go license & small optimization 2 years ago
error.go lint fixed 10 months ago
error_test.go license & small optimization 2 years ago
file.go lint fixed 10 months ago
file_test.go license & small optimization 2 years ago
form.go lint fixed 10 months ago
form_test.go added IsAjax and RemoteAddr for context, gofmt 2 years ago
group.go lint fixed 10 months ago
group_test.go improved group middlewares and added route middlewares support 1 year ago
logger.go add composite logger 10 months ago
logger_test.go license & small optimization 2 years ago
logo.png add logo 3 years ago
param.go lint fixed 10 months ago
param_test.go added IsAjax and RemoteAddr for context, gofmt 2 years ago
pool.go added IsAjax and RemoteAddr for context, gofmt 2 years ago
pool_test.go license & small optimization 2 years ago
prefix.go lint fixed 10 months ago
prefix_test.go license & small optimization 2 years ago
recovery.go lint fixed 10 months ago
recovery_test.go license & small optimization 2 years ago
response.go some docs & small improvements 2 years ago
return.go lint fixed 10 months ago
return_test.go lint fixed 10 months ago
router.go lint fixed 10 months ago
router_test.go bug fixed for router 1 year ago
static.go lint fixed 10 months ago
static_test.go license & small optimization 2 years ago
tan.go change version 10 months ago
tan_test.go license & small optimization 2 years ago

README.md

iiiiiiiiiTango 简体中文

CircleCI

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 github.com/lunny/tango

A classic usage of Tango below:

package main

import (
    "errors"
    "github.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.