Files
gf/.example/net/ghttp/server/static/static_path.go

15 lines
327 B
Go
Raw Normal View History

2018-11-16 18:20:09 +08:00
package main
2019-07-29 21:01:19 +08:00
import "github.com/gogf/gf/frame/g"
2018-11-16 18:20:09 +08:00
// 静态文件服务器,支持自定义静态目录映射
2018-11-16 18:20:09 +08:00
func main() {
2019-04-03 00:03:46 +08:00
s := g.Server()
s.SetIndexFolder(true)
s.SetServerRoot("/Users/john/Temp")
s.AddSearchPath("/Users/john/Documents")
s.AddStaticPath("/my-doc", "/Users/john/Documents")
s.SetPort(8199)
s.Run()
2018-11-16 18:20:09 +08:00
}