mirror of
https://gitee.com/johng/gf.git
synced 2024-12-04 21:28:22 +08:00
23 lines
476 B
Go
23 lines
476 B
Go
package main
|
|
|
|
import (
|
|
"github.com/gogf/gf/frame/g"
|
|
"github.com/gogf/gf/i18n/gi18n"
|
|
"github.com/gogf/gf/net/ghttp"
|
|
)
|
|
|
|
func main() {
|
|
s := g.Server()
|
|
s.Group("/", func(group *ghttp.RouterGroup) {
|
|
group.Middleware(func(r *ghttp.Request) {
|
|
r.SetCtx(gi18n.WithLanguage(r.Context(), r.GetString("lang", "zh-CN")))
|
|
r.Middleware.Next()
|
|
})
|
|
group.ALL("/", func(r *ghttp.Request) {
|
|
r.Response.WriteTplContent(`{#hello}{#world}!`)
|
|
})
|
|
})
|
|
s.SetPort(8199)
|
|
s.Run()
|
|
}
|