34

GitHub - karldoenitz/Tigo: A go restful framework

 5 years ago
source link: https://github.com/karldoenitz/Tigo
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

README.md

Build Status
Tigo logo

Tigo(For English Documentation Click Here)

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

安装

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

示例

Hello Tigo

package main

import "github.com/karldoenitz/Tigo/TigoWeb"

// handler
type HelloHandler struct {
    TigoWeb.BaseHandler
}

func (helloHandler *HelloHandler)Get() {
    helloHandler.ResponseAsHtml("<p1 style='color: red'>Hello Tigo!</p1>")
}

// url路由配置
var urls = map[string]interface{}{
    "/hello-tigo": &HelloHandler{},
}

// 主函数
func main() {
    application := TigoWeb.Application{
        IPAddress:  "0.0.0.0",
        Port:       8888,
        UrlPattern: urls,
    }
    application.Run()
}

编译

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

go build main.go

运行

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

./main

终端会有如下显示:

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

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

文档

点击此处

注意

这个框架在Linux版本的 CubeBackup for Google Apps 中有所使用。
如果你对此框架感兴趣,可以加入我们一同开发。


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK