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更好的性能。

Overview

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

鸣谢以下组织的支持

注意

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

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处理。

    bug 
    opened by FridayOK 6
  • 多线程输出异常

    多线程输出异常

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

    Description

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

    Operation

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

    Analysis(optional)

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

    bug 
    opened by karldoenitz 5
  • 关于 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
    help wanted good first issue 
    opened by BeanWei 3
  • 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命令

    invalid 
    opened by QinJiaQing 2
  • 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.
    new api 
    opened by LinZhai 1
  • API优化建议

    API优化建议

    • 建议增加两个重定向的API,分别对应http状态码307308; 【问题描述】
    • 目前的BaseHandler.RedirectBaseHandler.RedirectPermanently都会使浏览器默认采用Get请求方式,但根据RFC7231的标准,当使用307308两种状态码时,不允许重定向时发生请求方式变化。
    good first issue new api 
    opened by LinZhai 1
  • 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)
    }
    
    bug good first issue 
    opened by TreeNewBeef 1
  • 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,测试用例没有覆盖这个函数,修复这个函数即可。

    bug 
    opened by ssundabao 1
  • 接口访问时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就可以。

    bug good first issue 
    opened by FridayOK 1
  • 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="性能对比"/> 
    
    good first issue 
    opened by karldoenitz 1
  • 删除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)
    
    good first issue 
    opened by karldoenitz 1
Releases(v1.6.5)
  • v1.6.5(Dec 23, 2022)

    What's Changed

    • 调整代码 by @karldoenitz in https://github.com/karldoenitz/Tigo/pull/65
    • 重新设置中间件 by @karldoenitz in https://github.com/karldoenitz/Tigo/pull/67
    • Feature v1.6.5 by @karldoenitz in https://github.com/karldoenitz/Tigo/pull/68
    • Feature v1.6.5 by @karldoenitz in https://github.com/karldoenitz/Tigo/pull/69
    • 初步完成中间件改造 by @karldoenitz in https://github.com/karldoenitz/Tigo/pull/71
    • 调整代码命名规范 by @karldoenitz in https://github.com/karldoenitz/Tigo/pull/73
    • Feature v1.6.5 by @karldoenitz in https://github.com/karldoenitz/Tigo/pull/75
    • 规范化代码 by @karldoenitz in https://github.com/karldoenitz/Tigo/pull/76
    • Feature v1.6.5 by @karldoenitz in https://github.com/karldoenitz/Tigo/pull/77
    • 修复了2处命名不规范的问题 by @karldoenitz in https://github.com/karldoenitz/Tigo/pull/78
    • 修改变量命名规范 by @karldoenitz in https://github.com/karldoenitz/Tigo/pull/80
    • Feature v1.6.5 by @karldoenitz in https://github.com/karldoenitz/Tigo/pull/81
    • Feature v1.6.5 by @karldoenitz in https://github.com/karldoenitz/Tigo/pull/82

    Full Changelog: https://github.com/karldoenitz/Tigo/compare/v1.6.4...v1.6.5

    Source code(tar.gz)
    Source code(zip)
  • v1.6.4(Dec 1, 2022)

  • v1.6.3(Nov 29, 2022)

  • v1.6.2(Sep 17, 2022)

  • v1.6.1(Jun 24, 2021)

  • v1.6.0(Jun 6, 2020)

    【新增功能】

    • 分离出一个初始化app的接口,用于对接其他的非内嵌的平滑启动工具
    • 增加endless平滑启动
    • 增加overseer平滑启动

    【bug fix】

    • #50
    • #51
    Source code(tar.gz)
    Source code(zip)
  • v1.5.0(Nov 21, 2019)

    【新增功能】

    • session 使用redis配置session,支持选择redis的database
    • session 支持配置session过期时间
    • session 支持根据key清除session值
    Source code(tar.gz)
    Source code(zip)
  • v1.4.0(Nov 3, 2019)

    【新增功能】

    • session 配置接口,可供第三方自由开发配置session
    • session 读写接口预留
    • cookie 相关操作函数进行优化 【bugfix】
    • #49
    Source code(tar.gz)
    Source code(zip)
  • v1.3.0(Aug 14, 2019)

    【bugfix】

    • fix #39 【特性】
    • 新增3个重定向接口
    • 优化Response相关接口的代码
    • 优化log输出
    • 优化响应处理效率
    • 新增参数处理接口
    Source code(tar.gz)
    Source code(zip)
  • v1.2.1(Jul 26, 2019)

  • v1.2.0(Jul 24, 2019)

    CHANGELOG

    【新增功能】

    • BaseHandler.UrlEncode url编码
    • BaseHandler.UrlDecode url解码
    • Utils.UrlEncode url编码
    • Utils.UrlDecode url解码
    • 兼容tiger升级 【bugfix】
    • fix #27
    • fix #28
    • fix #29
    • fix #30
    • fix #31
    • fix #32
    • fix #33
    Source code(tar.gz)
    Source code(zip)
  • v1.1.1(Jul 12, 2019)

  • v1.1.0pre(Jul 12, 2019)

  • v1.0.9(Jun 26, 2019)

    CHANGELOG

    【新增功能】

    • handler代码优化
    • HTTPFileServer增加静态文件服务器,详情点击
    • SetAdvancedCookie新增cookie操作,详情点击
    • 文档完善
    • tiger工具优化
    • 官网页面调整
    Source code(tar.gz)
    Source code(zip)
  • v1.0.8-std(Jun 18, 2019)

  • v1.0.8(Jun 18, 2019)

    CHANGELOG

    【bug fix】

    • #21
    • #22

    【新增功能】

    • request包支持发送xml数据
    • request包增加自定义请求的函数
    • 增加Check函数,用于辅助参数校验,详情点击
    • 增加编码层级的全局配置
    • 完善tiger工具,增加新功能
    • 修复bug
    Source code(tar.gz)
    Source code(zip)
  • v1.0.7(May 5, 2019)

  • v1.0.6(Apr 22, 2019)

  • v1.0.5-231(Mar 29, 2019)

  • v1.0.5(Mar 20, 2019)

    CHANGELOG

    【bug fix】

    • #15
    • #16
    • #17

    【新增功能】

    • 新增了获取http响应状态码的struct和中间件
    • 新增了获取http响应时间的中间件
    Source code(tar.gz)
    Source code(zip)
  • v1.0.4(Feb 18, 2019)

  • v1.0.3(Jan 24, 2019)

  • v1.0.2(Jan 8, 2019)

  • v1.0.1(Dec 8, 2018)

    【bugfix】

    • #6
    • #5

    【新增功能】

    • 增加json binding,用来校验request提交的json数据,以及为相应字段设置默认值。
    • 增加form binding,用来校验request提交的form数据,以及为相应字段设置默认值。
    Source code(tar.gz)
    Source code(zip)
  • v1.0.0(Nov 29, 2018)

Owner
Karl
I am a Python programmer, I love Go and God, I trust rust.
Karl
⚡ 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

Gookit 84 Dec 8, 2022
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

Gearbox 696 Jan 3, 2023
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

Gearbox 695 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 Flamingo is a web framework based on Go. It is designed to build pluggable and maintainable web projects. It is production ready, f

Flamingo 343 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

golanger 298 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

null 8 Jul 14, 2022
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.

Gin-Gonic 65.5k 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).

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

Kamaleshwar 266 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

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

webgo A gin-like simple golang web framework.

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

A gin-like simple golang web framework.

vincent-言益 1 Aug 24, 2022
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

astaxie 592 Jan 1, 2023
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

LabStack LLC 24.6k 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

hidevops.io 179 Nov 20, 2022
High performance, simple Go web framework

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

Tree Xie 63 Dec 17, 2022
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

beego Framework 29.3k 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

wjp 350 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. 中文

dragon 8 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

azerothyang 0 Sep 6, 2022