Micro & pluggable web framework for Go
Go to file
Lunny Xiao 275a50e0d5
All checks were successful
checks / check and test (push) Successful in 51s
Use actions instead of drone
2023-04-21 11:47:15 +08:00
.gitea/workflows Use actions instead of drone 2023-04-21 11:47:15 +08:00
public fix static compitable when prefix is / 2017-05-17 15:34:13 +08:00
.gitignore Safe parse form and remove unnecessary parse on query (#63) 2019-09-19 01:04:09 +00:00
compress_test.go license & small optimization 2015-04-28 15:42:01 +08:00
compress.go lint fixed 2017-03-07 21:27:26 +08:00
context_test.go More tests 2020-12-09 20:53:37 +08:00
context.go Download support special filename 2021-01-06 14:11:22 +08:00
cookie_test.go lint fixed 2017-03-07 21:27:26 +08:00
cookie.go update cookie (#44) 2017-08-28 21:47:36 +08:00
doc.go update README (#56) 2019-05-19 06:30:19 +00:00
error_test.go license & small optimization 2015-04-28 15:42:01 +08:00
error.go Add query functions and upgrade circleci to 2 (#51) 2019-01-25 17:50:54 +08:00
file_test.go Add Content to serve a file from http.FileSystem (#62) 2019-09-08 13:30:17 +00:00
file.go Add Content to serve a file from http.FileSystem (#62) 2019-09-08 13:30:17 +00:00
form_test.go Add FormTrimmed (#61) 2019-08-21 06:31:28 +00:00
form.go Add form exist (#67) 2021-12-02 10:57:08 +08:00
go.mod use new package name (#55) 2019-05-19 05:46:52 +00:00
go.sum change log location 2019-03-22 13:46:26 +08:00
group_test.go add handlers support on group method (#54) 2019-05-17 11:31:10 +08:00
group.go add handlers support on group method (#54) 2019-05-17 11:31:10 +08:00
handler_test.go bug fixed for second group 2018-04-12 22:57:22 +08:00
LICENSE license & small optimization 2015-04-28 15:42:01 +08:00
logger_test.go change log location 2019-03-22 13:46:26 +08:00
logger.go change log location 2019-03-22 13:46:26 +08:00
logo.png add logo 2014-12-25 13:21:52 +08:00
param_test.go added IsAjax and RemoteAddr for context, gofmt 2015-10-26 12:01:01 +08:00
param.go lint fixed 2017-03-07 21:27:26 +08:00
pool_test.go license & small optimization 2015-04-28 15:42:01 +08:00
pool.go pool size support disabled when is zero 2018-01-04 10:38:42 +08:00
prefix_test.go license & small optimization 2015-04-28 15:42:01 +08:00
prefix.go lint fixed 2017-03-07 21:27:26 +08:00
query_test.go Add query functions and upgrade circleci to 2 (#51) 2019-01-25 17:50:54 +08:00
query.go Safe parse form and remove unnecessary parse on query (#63) 2019-09-19 01:04:09 +00:00
README_CN.md Update drone and README 2021-06-24 19:40:43 +08:00
README.md Update drone and README 2021-06-24 19:40:43 +08:00
recovery_test.go license & small optimization 2015-04-28 15:42:01 +08:00
recovery.go lint fixed 2017-03-07 21:27:26 +08:00
RELEASE.md docs 2015-03-21 17:42:25 +08:00
response.go some docs & small improvements 2015-05-04 10:51:09 +08:00
return_test.go add more tests (#58) 2019-06-12 08:59:57 +00:00
return.go add errorwithcode interface 2017-08-29 13:16:57 +08:00
router_test.go Add more tests about any (#64) 2019-10-28 07:27:29 +00:00
router.go More tests 2020-12-09 20:53:37 +08:00
static_test.go fix static compitable when prefix is / 2017-05-17 15:34:13 +08:00
static.go Fix up to parent directory 2020-03-26 17:18:25 +08:00
tan_test.go Add SetMinTLSVersion to support min tls version (#66) 2020-11-07 09:51:25 +08:00
tan.go Add SetMinTLSVersion to support min tls version (#66) 2020-11-07 09:51:25 +08:00

Tango 简体中文

Build Status badge Join the chat at https://img.shields.io/discord/323705316027924491.svg

Tango Logo

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

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.