Prise en compte des routes gérées par le client côté serveur
This commit is contained in:
parent
8d9d839acf
commit
c0ee95234d
|
@ -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))
|
||||
|
||||
|
|
Loading…
Reference in New Issue