github.com/gogf/gf@v1.16.9/.example/net/ghttp/server/static/static.go (about)

     1  package main
     2  
     3  import "github.com/gogf/gf/frame/g"
     4  
     5  // 静态文件服务器基本使用
     6  func main() {
     7  	s := g.Server()
     8  	s.SetIndexFolder(true)
     9  	s.SetServerRoot("/Users/john/Downloads")
    10  	//s.AddSearchPath("/Users/john/Documents")
    11  	s.SetErrorLogEnabled(true)
    12  	s.SetAccessLogEnabled(true)
    13  	s.SetPort(8199)
    14  	s.Run()
    15  }