trim /public from http

This commit is contained in:
bel
2023-10-29 09:52:57 -06:00
parent b006333035
commit 58cafcfaa3
3 changed files with 10 additions and 5 deletions

View File

@@ -6,6 +6,7 @@ import (
"flag"
"fmt"
"io"
"io/fs"
"log"
"maps"
"net/http"
@@ -29,9 +30,13 @@ import (
var _staticFileDir embed.FS
var publicHandler = func() http.Handler {
if os.Getenv("DEBUG") != "" {
return http.FileServer(http.Dir("./http"))
return http.FileServer(http.Dir("./http/public"))
}
return http.FileServer(http.FS(_staticFileDir))
sub, err := fs.Sub(_staticFileDir, "public")
if err != nil {
panic(err)
}
return http.FileServer(http.FS(sub))
}()
func Main() {