Serving static content with a root URL with the Gorilla toolkit

后端 未结 5 2130
礼貌的吻别
礼貌的吻别 2020-12-12 18:42

I am attempting to use the Gorilla toolkit\'s mux package to route URLs in a Go web server. Using this question as a guide I have the following Go code:

fu         


        
5条回答
  •  青春惊慌失措
    2020-12-12 19:41

    Try this:

    fileHandler := http.StripPrefix("/static/", http.FileServer(http.Dir("/absolute/path/static")))
    http.Handle("/static/", fileHandler)
    

提交回复
热议问题