Search code examples
gogorillamux

Serve HTML with gorilla mux


I have a golang app that needs a homepage. I'm struggling to get it to serve a simple html file. I'm able to do it locally like this:

router.PathPrefix("/").Handler(http.FileServer(http.Dir("./views/")))

This works for me on Windows and Pop OS, however, when I deploy this to my ubuntu server on AWS, it says 404 not found.


Solution

  • On ubuntu use full adress like http.dir(/root/workpath/yourgofolder/projectfolder/