Micro-kernel & pluggable web framework for Go

Lunny Xiao 227eca782a readme added log history 9 سال پیش
public 33870517d0 more tests 10 سال پیش
LICENSE 717e190c9b add some tests 10 سال پیش
README.md 227eca782a readme added log history 9 سال پیش
README_CN.md 227eca782a readme added log history 9 سال پیش
compress.go 664c79d97e use short name handlers 10 سال پیش
compress_test.go c252141adf more tests & bug fixed 10 سال پیش
context.go 38efae9eed bug fixed 9 سال پیش
context_test.go 699274c35a use http.Redirect 10 سال پیش
cookie.go 0b5fb39f0b add cookie support 10 سال پیش
cookie_test.go 9a918d2658 remove unimported 10 سال پیش
doc.go 6bdde8c8ad remove unused codes 10 سال پیش
error.go b66036b2c0 more tests 10 سال پیش
error_test.go b86738a561 add custom error handler test 10 سال پیش
group.go 6bdde8c8ad remove unused codes 10 سال پیش
group_test.go 6bdde8c8ad remove unused codes 10 سال پیش
logger.go 83c6f716fb small improvements 9 سال پیش
logger_test.go 664c79d97e use short name handlers 10 سال پیش
logo.png 589171832c add logo 10 سال پیش
param.go 664c79d97e use short name handlers 10 سال پیش
param_test.go 717e190c9b add some tests 10 سال پیش
pool.go 5b95321382 more tests 10 سال پیش
pool_test.go 5b95321382 more tests 10 سال پیش
recovery.go 58fe74df75 add default errorhandler and the way to custom errorhandler 10 سال پیش
recovery_test.go 58fe74df75 add default errorhandler and the way to custom errorhandler 10 سال پیش
request.go 664c79d97e use short name handlers 10 سال پیش
request_test.go 717e190c9b add some tests 10 سال پیش
response.go 6bdde8c8ad remove unused codes 10 سال پیش
response_test.go 717e190c9b add some tests 10 سال پیش
return.go b86738a561 add custom error handler test 10 سال پیش
return_test.go b66036b2c0 more tests 10 سال پیش
router.go 611cece6f3 bug fixed 9 سال پیش
router_test.go 5cc833fe2a add custom method 9 سال پیش
static.go c89aa1ba13 more features for static 9 سال پیش
static_test.go 2968d3a055 add staticoptions 10 سال پیش
tan.go 95d48b1eb1 bug fixed 9 سال پیش
tan_test.go b66036b2c0 more tests 10 سال پیش

README.md

Tango Build Status 简体中文

Tango Logo

Package tango is a micro-kernel & pluggable web framework for Go.

Current version: v0.2.8 Version History

Getting Started

To install Tango:

go get github.com/lunny/tango

The very basic usage of Tango:

package main

import "github.com/lunny/tango"

func main() {
    t := tango.Classic()
    t.Get("/", func() string {
        return "Hello tango!"
    })
    t.Run()
}

Then visit http://localhost:8000 on your browser. Of course, tango support struct form also.

package main

import "github.com/lunny/tango"

type Action struct {
    tango.Json
}

func (Action) Get() map[string]string {
    return map[string]string{
        "say": "Hello tango!",
    }
}

func main() {
    t := tango.Classic()
    t.Get("/", new(Action))
    t.Run()
}

This code will automatically convert returned map to a json because we has an embedded struct tango.Json.

More document, please see godoc and Wiki

Features

  • Powerful routing & Flexible routes combinations.
  • Directly integrate with existing services.
  • Easy to plugin/unplugin features with modular design.
  • High performance dependency injection embedded.

Middlewares

Middlewares allow you easily plugin/unplugin features for your Tango applications.

There are already many middlewares to simplify your work:

  • recovery - recover after panic
  • compress - Gzip & Deflate compression
  • static - Serves static files
  • logger - Log the request & inject Logger to action struct
  • param - get the router parameters
  • return - Handle the returned value smartlly
  • request - Inject request to action struct
  • response - Inject response to action struct
  • session - Build Status Session manager
  • xsrf - Build Status Generates and validates csrf tokens
  • binding - Build Status Bind and validates forms
  • renders - Build Status Go template engine
  • dispatch - Build Status Multiple Application support on one server
  • tpongo2 - Build Status Pongo2 teamplte engine support
  • captcha - Build Status Captcha
  • events - Build Status Before and After
  • flash - Build Status Share data between requests
  • debug - Build Status show detail debug infomaton on log

Getting Help

Cases

License

This project is under BSD License. See the LICENSE file for the full license text.