diff options
Diffstat (limited to 'handlers.go')
| -rw-r--r-- | handlers.go | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/handlers.go b/handlers.go index 141230d..d28a491 100644 --- a/handlers.go +++ b/handlers.go @@ -6,20 +6,22 @@ import ( "io/fs" "log" "net/http" + + "github.com/gorilla/mux" ) //go:embed build/frontend/public var frontendEmbed embed.FS -func init() { - router.HandleFunc("/api/version", version) +func registerHandlers(r *mux.Router) { + r.HandleFunc("/api/version", version) // frontend must come last to make sure /api takes precedence frontend, err := fs.Sub(frontendEmbed, "build/frontend/public") if err != nil { log.Fatalf("No embedded frontend: %v.", err) } - router.PathPrefix("/").Handler(http.FileServerFS(frontend)) + r.PathPrefix("/").Handler(http.FileServerFS(frontend)) } func version(w http.ResponseWriter, r *http.Request) { |
