Merge branch 'develop' into dist/ubuntu/bionic/develop

This commit is contained in:
wpetit 2020-07-23 08:58:04 +02:00
commit 9749ede28a
1 changed files with 12 additions and 0 deletions

View File

@ -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))