Micro & pluggable web framework for Go
Go to file
Lunny Xiao 377f512fcb bug fixed for regex router 2015-04-21 17:21:10 +08:00
public added more tests 2015-04-16 23:20:30 +08:00
compress_test.go new route algrithm 2015-04-05 15:05:46 +08:00
compress.go use short name handlers 2015-01-05 18:09:06 +08:00
context_test.go more tests & docs 2015-04-17 16:11:59 +08:00
context.go README 2015-04-18 17:13:39 +08:00
cookie_test.go more tests & docs 2015-04-17 16:11:59 +08:00
cookie.go more tests & docs 2015-04-17 16:11:59 +08:00
doc.go more router tests 2015-04-15 17:45:12 +08:00
error_test.go more tests & docs 2015-04-17 16:11:59 +08:00
error.go more tests & docs 2015-04-17 16:11:59 +08:00
file_test.go more tests & docs 2015-04-17 16:11:59 +08:00
file.go add File & Dir for convience 2015-04-14 16:51:16 +08:00
group_test.go more tests & docs 2015-04-17 16:11:59 +08:00
group.go added Prefix() func, Use() method for Group and resolved #2 2015-03-20 22:01:19 +08:00
LICENSE add some tests 2014-12-25 12:46:07 +08:00
logger_test.go more tests & docs 2015-04-17 16:11:59 +08:00
logger.go add SaveToFile for context; remove Mode of tango 2015-04-10 10:31:40 +08:00
logo.png add logo 2014-12-25 13:21:52 +08:00
param_test.go bug fixed for regex router 2015-04-21 17:21:10 +08:00
param.go bug fixed for param set 2015-04-12 16:00:52 +08:00
pool_test.go more tests 2014-12-25 16:27:12 +08:00
pool.go more tests 2014-12-25 16:27:12 +08:00
prefix_test.go added Prefix() func, Use() method for Group and resolved #2 2015-03-20 22:01:19 +08:00
prefix.go added Prefix() func, Use() method for Group and resolved #2 2015-03-20 22:01:19 +08:00
README_CN.md more tests 2015-04-21 10:04:02 +08:00
README.md README 2015-04-19 16:59:05 +08:00
recovery_test.go add default errorhandler and the way to custom errorhandler 2015-01-12 10:49:38 +08:00
recovery.go add default errorhandler and the way to custom errorhandler 2015-01-12 10:49:38 +08:00
RELEASE.md docs 2015-03-21 17:42:25 +08:00
response.go new route algrithm 2015-04-05 15:05:46 +08:00
return_test.go more tests 2015-01-12 11:20:26 +08:00
return.go add custom error handler test 2015-01-12 14:26:12 +08:00
router_test.go bug fixed for regex router 2015-04-21 17:21:10 +08:00
router.go bug fixed for regex router 2015-04-21 17:21:10 +08:00
static_test.go added more tests 2015-04-16 23:20:30 +08:00
static.go bug fixed for static 2015-04-03 14:21:21 +08:00
tan_test.go added more tests 2015-04-16 23:20:30 +08:00
tan.go bug fixed for regex router 2015-04-21 17:21:10 +08:00

Tango Build Status 简体中文

Tango Logo

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

Current version: v0.4.4 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:

  • 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
  • context - Inject context 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
  • basicauth - Build Status basicauth middleware

Getting Help

Cases

License

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