Tigo
v2.0.1
A web framework developed using Go language.
tiger is a scaffolding tool tailored for Tigo frameworks. You can use tiger to create new Tigo projects or perform other operations.tission is a session plugin customized for Tigo . export GO111MODULE=off ;
go get github.com/karldoenitz/Tigo/...
export GO111MODULE=on ; export GO111MODULE=off ;
go get -u github.com/karldoenitz/Tigo/...
export GO111MODULE=on ; go get github.com/karldoenitz/Tigo@{version} package main
import (
"github.com/karldoenitz/Tigo/web"
"net/http"
)
// DemoHandler handler
type DemoHandler struct {
web. BaseHandler
}
func ( demoHandler * DemoHandler ) Get () {
demoHandler . ResponseAsText ( "Hello Demo!" )
}
// Authorize 中间件
func Authorize ( w * http. ResponseWriter , r * http. Request ) bool {
// 此处返回true表示继续执行,false则直接返回,后续的中间件不会执行
return true
}
// 路由
var urls = []web. Pattern {
{ "/demo" , DemoHandler {}, []web. Middleware { Authorize }},
}
func main () {
application := web. Application {
IPAddress : "127.0.0.1" ,
Port : 8888 ,
UrlPatterns : urls ,
}
application . Run ()
}Open the terminal, enter the code directory, and run the following command:
go build main.go After compilation is completed, there will be an executable file main , and the following command will be run:
./mainThe terminal will display as follows:
INFO 2022/10/07 22:40:36 Server run on: http://127.0.0.1:8080
Open the browser and access the address http://127.0.0.1:8888/demo and you can see Hello Demo.
Click here
If you are interested in this framework, you can join us to develop it.