mirror of
https://gitee.com/johng/gf
synced 2026-06-27 01:43:33 +08:00
30 lines
571 B
Go
30 lines
571 B
Go
package main
|
|
|
|
import (
|
|
"fmt"
|
|
|
|
"github.com/gogf/gf/frame/g"
|
|
"github.com/gogf/gf/net/ghttp"
|
|
"github.com/gogf/gf/os/gres"
|
|
_ "github.com/gogf/gf/os/gres/testdata/data"
|
|
)
|
|
|
|
func main() {
|
|
gres.Dump()
|
|
|
|
//v := g.View()
|
|
//v.SetPath("template/layout1")
|
|
|
|
s := g.Server()
|
|
s.SetIndexFolder(true)
|
|
s.SetServerRoot("root")
|
|
s.BindHookHandler("/*", ghttp.HOOK_BEFORE_SERVE, func(r *ghttp.Request) {
|
|
fmt.Println(r.URL.Path, r.IsFileRequest())
|
|
})
|
|
s.BindHandler("/template", func(r *ghttp.Request) {
|
|
r.Response.WriteTpl("layout1/layout.html")
|
|
})
|
|
s.SetPort(8198)
|
|
s.Run()
|
|
}
|