Git Product home page Git Product logo

lxngoddess5321 / tigo Goto Github PK

View Code? Open in Web Editor NEW

This project forked from karldoenitz/tigo

0.0 0.0 0.0 3.95 MB

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

Home Page: https://karldoenitz.github.io/Tigo/

License: MIT License

Go 100.00%

tigo's Introduction

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

一个使用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

鸣谢以下组织的支持

注意

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

tigo's People

Contributors

karldoenitz avatar linzhai avatar blessurb avatar treenewbeef avatar ssundabao avatar fugui1234 avatar iinjil avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.