Tigo is an HTTP web framework written in Go (Golang).It features a Tornado-like API with better performance. Tigo是一款用Go语言开发的web应用框架,API特性类似于Tornado并且拥有比Tornado更好的性能。

Badge LICENSE Build Status Join the chat at https://gitter.im/karlooper/Tigo Open Source Helpers Go Report Card GoDoc Release
Tigo logo

Tigo(For English Documentation Click Here)

一个使用Go语言开发的web框架。

相关工具及插件

  • tiger
    tiger是一个专门为Tigo框架量身定做的脚手架工具,可以使用tiger新建Tigo项目或者执行其他操作。
    查看tiger
  • tission
    tission是一个为Tigo定制的session插件。
    查看tission

安装

go get github.com/karldoenitz/Tigo/...

示例

Hello Tigo

package main

import (
    "github.com/karldoenitz/Tigo/TigoWeb"
    "net/http"
)

// handler
type DemoHandler struct {
    TigoWeb.BaseHandler
}

func (demoHandler *DemoHandler) Get() {
    demoHandler.ResponseAsText("Hello Demo!")
}

// 中间件
func Authorize(next http.HandlerFunc) http.HandlerFunc {
    return func(w http.ResponseWriter, r *http.Request) {
        // 此处授权认证逻辑
        next.ServeHTTP(w, r)
    }
}

// 路由
var urls = []TigoWeb.Router{
    {"/demo", DemoHandler{}, []TigoWeb.Middleware{Authorize}},
}

func main() {
    application := TigoWeb.Application{
        IPAddress:  "127.0.0.1",
        Port:       8888,
        UrlRouters: urls,
    }
    application.Run()
}

编译

打开终端,进入代码目录,运行如下命令:

go build main.go

运行

编译完成后,会有一个可执行文件main,运行如下命令:

./main

终端会有如下显示:

INFO: 2018/07/09 15:02:36 Application.go:22: Server run on: 127.0.0.1:8888

打开浏览器访问地址http://127.0.0.1:8888/hello-tigo,就可以看到Hello Tigo。

性能对比

文档

点击此处

都有谁在使用Tigo

鸣谢以下组织的支持

注意

如果你对此框架感兴趣,可以加入我们一同开发。

Owner
Karl
I am a Python programmer, I love Go and God, I trust rust.
Karl
Comments
  • 出现500错误时连接中断,并没有响应客户端

    出现500错误时连接中断,并没有响应客户端

    • go version: 1.x
    • Tigo version (or commit ref): 1.0.3
    • operating system: Windows Linux Mac都有这个问题

    Description

    【问题描述】服务运行时出现错误,无论什么错误,直接服务就中断了,没有给客户端任何响应。

    Operation

    【操作步骤】在Handler中panic一下就可以复现。

    Analysis(optional)

    【问题分析】框架的中间层代码并没有对错误异常进行recover处理。

  • 多线程输出异常

    多线程输出异常

    • go version: all
    • Tigo version (or commit ref): all
    • operating system: all

    Description

    [description]
    【问题描述】客户端开多进程或多线程,请求服务端,返回数据紊乱

    Operation

    [operation]
    【操作步骤】随便找一种编程语言,多线程3000个请求

    Analysis(optional)

    [analysis]
    【问题分析】连接公用一个对象,没有重新实例化responsewriter造成的

  • 关于 Response 接口?

    关于 Response 接口?

    RT, 小白有个疑问,为什么 Response 类型不直接定义一个空接口,感觉现在这种写起来有点拖沓。还是我写法有问题?

    helloHandler.ResponseAsJson(struct {
    	TigoWeb.Response
    	Status string `json:"status"`
    }{Status: "ok"})
    

    另外 还有两点建议:

    • 例子中可以添加 ResponseAsJson 的实列吗?
    • 示例中的 IP 建议还是设置为 127.0.0.1 吧,设置 0.0.0.0 有点坑0.0
  • tiger工具不能更新项目

    tiger工具不能更新项目

    • With issues:

      • Use the search tool before opening a new issue.
      • Please provide source code and commit sha if you found a bug.
      • Review existing issues and provide feedback or react to them.
    • go version: 1.9

    • Tigo version (or commit ref):1.0.7

    • operating system:Windows8

    Description

    [description]
    【问题描述】tiger update更新框架不成功

    Operation

    [operation]
    【操作步骤】直接直行update命令

  • Update documentation_en.md

    Update documentation_en.md

    • With pull requests:
      • Open your pull request against master
      • Your pull request should have no more than two commits, if not you should squash them.
      • It should pass all tests in the available continuous integrations systems such as TravisCI.
      • You should add/modify tests to cover your proposed code changes.
      • If your pull request contains a new feature, please document it on the README.
  • API优化建议

    API优化建议

    • 建议增加两个重定向的API,分别对应http状态码307308; 【问题描述】
    • 目前的BaseHandler.RedirectBaseHandler.RedirectPermanently都会使浏览器默认采用Get请求方式,但根据RFC7231的标准,当使用307308两种状态码时,不允许重定向时发生请求方式变化。
  • redirctpermanetly无法重定向

    redirctpermanetly无法重定向

    • go version: all
    • Tigo version (or commit ref): all
    • operating system: all

    Description

    【问题描述】永久重定向无效

    Operation

    【操作步骤】 执行如下代码:

    package main
    
    import "github.com/karldoenitz/Tigo/TigoWeb"
    
    type HelloWorldHandler struct {
    	TigoWeb.BaseHandler
    }
    
    func (h *HelloWorldHandler) Get() {
    	h.RedirectPermanently("https://www.github.com")
    }
    
    var urls = []TigoWeb.Router{
    	{"/hello-world", &HelloWorldHandler{}, nil},
    }
    
    func main() {
    	application := TigoWeb.Application{IPAddress: "0.0.0.0", Port: 8888, UrlRouters: urls}
    	application.Run()
    }
    

    Analysis(optional)

    【问题分析】

    • 先ResponseWriter.WriteHeader,再调用SetHeader,不会生效
    • 需要先进行SetHeader 将代码改为如下即可
    // RedirectPermanently 向客户端永久重定向一个地址
    func (baseHandler *BaseHandler) RedirectPermanently(url string) {
    	baseHandler.SetHeader("Location", url)
    	baseHandler.ResponseWriter.WriteHeader(http.StatusMovedPermanently)
    	baseHandler.ResponseWriter.Write(nil)
    }
    
  • CheckFormBinding错误

    CheckFormBinding错误

    • go version: all
    • Tigo version (or commit ref): all
    • operating system: all

    Description

    【问题描述】使用CheckFormBinding和CheckParamBinding都不能检验form的合法性

    Operation

    【操作步骤】直接post请求,就会复现

    Analysis(optional)

    【问题分析】binding.UnmarshalForm有bug,测试用例没有覆盖这个函数,修复这个函数即可。

  • 接口访问时log级别问题

    接口访问时log级别问题

    Info

    • go version: all
    • Tigo version (or commit ref): all
    • operating system: all

    Description

    【问题描述】 访问接口时打印的log,级别都是trace级别,不严谨,trace一般是跟进问题时使用此级别。

    Operation

    【操作步骤】 随机访问一个接口查看log即可。

    Analysis(optional)

    【问题分析】 Trace级别是跟进排查,普通的log打印使用info就可以。

  • ReadMe文件中性能对比图连接需要换一下

    ReadMe文件中性能对比图连接需要换一下

    第82行md标签:

    <img src="https://github.com/karldoenitz/Tigo/blob/master/documentation/chart.png" width="100%" height="300px" alt="性能对比"/> 
    

    替换成如下所示:

    <img src="https://raw.githubusercontent.com/karldoenitz/Tigo/master/documentation/chart.png" width="100%" height="300px" alt="性能对比"/> 
    
  • 删除Travis-CI的配置,迁移到github action

    删除Travis-CI的配置,迁移到github action

    Travis-CI开始收费了,之前配置的CI已经不能用了,需要迁移到github自己免费的CI上使用。 示例如下:

    ![action图标](https://github.com/dotnet-campus/dotnetcampus.DotNETBuildSDK/workflows/.NET%20Core/badge.svg)
    
⚡ Rux is an simple and fast web framework. support middleware, compatible http.Handler interface. 简单且快速的 Go web 框架,支持中间件,兼容 http.Handler 接口

Rux Simple and fast web framework for build golang HTTP applications. NOTICE: v1.3.x is not fully compatible with v1.2.x version Fast route match, sup

Dec 8, 2022
Gearbox :gear: is a web framework written in Go with a focus on high performance
Gearbox :gear: is a web framework written in Go with a focus on high performance

gearbox ⚙️ is a web framework for building micro services written in Go with a focus on high performance. It's built on fasthttp which is up to 10x fa

Jan 3, 2023
Gearbox :gear: is a web framework written in Go with a focus on high performance
Gearbox :gear: is a web framework written in Go with a focus on high performance

gearbox ⚙️ is a web framework for building micro services written in Go with a focus on high performance. It's built on fasthttp which is up to 10x fa

Dec 29, 2022
Flamingo Framework and Core Library. Flamingo is a go based framework for pluggable web projects. It is used to build scalable and maintainable (web)applications.
Flamingo Framework and Core Library. Flamingo is a go based framework for pluggable web projects. It is used to build scalable and maintainable (web)applications.

Flamingo Framework Flamingo is a web framework based on Go. It is designed to build pluggable and maintainable web projects. It is production ready, f

Jan 5, 2023
Golanger Web Framework is a lightweight framework for writing web applications in Go.

/* Copyright 2013 Golanger.com. All rights reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except

Nov 14, 2022
The jin is a simplified version of the gin web framework that can help you quickly understand the core principles of a web framework.

jin About The jin is a simplified version of the gin web framework that can help you quickly understand the core principles of a web framework. If thi

Jul 14, 2022
Gin is a HTTP web framework written in Go (Golang).
Gin is a HTTP web framework written in Go (Golang).

Gin is a HTTP web framework written in Go (Golang). It features a Martini-like API with much better performance -- up to 40 times faster. If you need smashing performance, get yourself some Gin.

Jan 3, 2023
A minimal framework to build web apps; with handler chaining, middleware support; and most of all standard library compliant HTTP handlers(i.e. http.HandlerFunc).
A minimal framework to build web apps; with handler chaining, middleware support; and most of all standard library compliant HTTP handlers(i.e. http.HandlerFunc).

WebGo v4.1.3 WebGo is a minimalistic framework for Go to build web applications (server side) with zero 3rd party dependencies. Unlike full-fledged fr

Jan 1, 2023
a golang web mvc framework, like asp.net mvc.

goku goku is a Web Mvc Framework for golang, mostly like ASP.NET MVC. doc & api Installation To install goku, simply run go get github.com/QLeelulu/go

Dec 7, 2022
A gin-like simple golang web framework.

webgo A gin-like simple golang web framework.

Aug 24, 2022
A gin-like simple golang web framework.

A gin-like simple golang web framework.

Aug 24, 2022
beego is an open-source, high-performance web framework for the Go programming language.
beego is an open-source, high-performance web framework for the Go programming language.

Beego Beego is used for rapid development of enterprise application in Go, including RESTful APIs, web apps and backend services. It is inspired by To

Jan 1, 2023
High performance, minimalist Go web framework
High performance, minimalist Go web framework

Supported Go versions As of version 4.0.0, Echo is available as a Go module. Therefore a Go version capable of understanding /vN suffixed imports is r

Jan 2, 2023
hiboot is a high performance web and cli application framework with dependency injection support

Hiboot - web/cli application framework About Hiboot is a cloud native web and cli application framework written in Go. Hiboot is not trying to reinven

Nov 20, 2022
High performance, simple Go web framework

Elton Elton的实现参考了koa以及echo,中间件的调整均为洋葱模型:请求由外至内,响应由内至外。主要特性如下: 处理函数(中间件)均以返回error的形式响应出错,方便使用统一的出错处理中间件将出错统一转换为对应的输出(JSON),并根据出错的类型等生成各类统计分析 成功响应数据直接赋值

Dec 17, 2022
beego is an open-source, high-performance web framework for the Go programming language.
beego is an open-source, high-performance web framework for the Go programming language.

Beego Beego is used for rapid development of enterprise application in Go, including RESTful APIs, web apps and backend services. It is inspired by To

Jan 8, 2023
letgo is an open-source, high-performance web framework for the Go programming language.

high-performance Lightweight web framework for the Go programming language. golang web framework,高可用golang web框架,go语言 web框架 ,go web

Sep 23, 2022
Dragon 🐲 🐲 🐲 is an enterprise high performance web framework with Go for the feature and comfortable develop.

Dragon start dragon ab performance Dragon ?? ?? ?? is a lightweight high performance web framework with Go for the feature and comfortable develop. 中文

Sep 14, 2022
Dragon 🐲 🐲 🐲 is a lightweight high performance web framework with Go for the feature and comfortable develop.

Dragon project new link start dragon ab performance Dragon ?? ?? ?? is a lightweight high performance web framework with Go for the feature and comfor

Sep 6, 2022