mirror of
https://gitee.com/johng/gf
synced 2026-06-30 11:05:11 +08:00
28 lines
496 B
Go
28 lines
496 B
Go
package main
|
|
|
|
import (
|
|
"fmt"
|
|
|
|
"github.com/gogf/gf"
|
|
"github.com/gogf/gf/g/net/ghttp"
|
|
|
|
"github.com/gogf/gf/g"
|
|
)
|
|
|
|
func main() {
|
|
// fmt.Print(g.)
|
|
fmt.Println(gf.VERSION)
|
|
s := g.Server()
|
|
|
|
s.BindHandler("/status/:status", func(r *ghttp.Request) {
|
|
r.Response.Write("woops, status ", r.Get("status"), " found")
|
|
})
|
|
s.BindStatusHandler(404, func(r *ghttp.Request) {
|
|
r.Response.RedirectTo("/status/404")
|
|
})
|
|
|
|
s.SetErrorLogEnabled(true)
|
|
s.SetAccessLogEnabled(true)
|
|
s.SetPort(8890)
|
|
s.Run()
|
|
} |