Skip to content

Commit

Permalink
fix(backend): update public path
Browse files Browse the repository at this point in the history
  • Loading branch information
Björn Urban committed Oct 11, 2023
1 parent 4fa1559 commit 65c171f
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions backend/cmd/kubevoyage/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,15 +35,15 @@ func setupServer(handle *handlers.Handler) http.Handler {
handler := cors.Default().Handler(mux)

// Serve static files
fs := http.FileServer(http.Dir("../public/")) // Adjust the path based on your directory structure
fs := http.FileServer(http.Dir("./public/")) // Adjust the path based on your directory structure
mux.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
// Check if it's an API route first
if isAPIRoute(r.URL.Path) {
// Handle API routes separately
return
}

path := "../public" + r.URL.Path
path := "./public" + r.URL.Path
absolutePath, err := filepath.Abs(path)
if err != nil {
fmt.Println("Error getting absolute path:", err)
Expand All @@ -60,7 +60,7 @@ func setupServer(handle *handlers.Handler) http.Handler {
log.Println(err)
}
// Otherwise, serve index.html
http.ServeFile(w, r, "../public/index.html")
http.ServeFile(w, r, "./public/index.html")
})

mux.HandleFunc("/api/requests", func(w http.ResponseWriter, r *http.Request) {
Expand Down

0 comments on commit 65c171f

Please sign in to comment.