diff --git a/internal/route/mount.go b/internal/route/mount.go index af4d08b..650cf06 100644 --- a/internal/route/mount.go +++ b/internal/route/mount.go @@ -2,6 +2,7 @@ package route import ( "net/http" + "path" "time" "forge.cadoles.com/Cadoles/daddy/internal/config" @@ -62,6 +63,17 @@ func Mount(r *chi.Mux, config *config.Config) error { r.Handle("/v1/graphql", gql) }) + clientIndex := path.Join(config.HTTP.PublicDir, "index.html") + + serveClientIndex := func(w http.ResponseWriter, r *http.Request) { + http.ServeFile(w, r, clientIndex) + } + + // List of paths handled directly by the client + r.Get("/workgroups/*", serveClientIndex) + r.Get("/profile", serveClientIndex) + + // Serve static files notFoundHandler := r.NotFoundHandler() r.Get("/*", static.Dir(config.HTTP.PublicDir, "", notFoundHandler))