Go http.FileServer http.DIr remove the .html suffix mux router

110 Views Asked by At

I'm serving a static folder using mux.

enter image description here

Navigating the "/" on my server renders index.html, and navigating to "/help.html" renders the help page. Is there a way I can dynamically serve this folder and remove the html suffix on routes?

This what I am currently doing.

    router := mux.NewRouter()
    router.PathPrefix("/").Handler(http.FileServer(http.Dir("./static")))
0

There are 0 best solutions below