mirror of
https://github.com/R0m1k3/FlowReader.git
synced 2026-10-11 17:28:05 +02:00
fix(backend): solve 500 errors with auto-migrations and standardized filenames
This commit is contained in:
1 parent
8ed1782de6
commit
502b76c5d6
6 files changed
+83
-36
No files matched your search
@@ -139,6 +139,21 @@ func main() {
|
||||
})
|
||||
})
|
||||
|
||||
// Serve Static Files (Frontend)
|
||||
staticPath := "./web/dist"
|
||||
if _, err := os.Stat(staticPath); err == nil {
|
||||
fs := http.FileServer(http.Dir(staticPath))
|
||||
r.Handle("/*", http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
||||
// If the file exists, serve it, otherwise serve index.html (for SPA routing)
|
||||
path := staticPath + r.URL.Path
|
||||
if _, err := os.Stat(path); os.IsNotExist(err) {
|
||||
http.ServeFile(w, r, staticPath+"/index.html")
|
||||
return
|
||||
}
|
||||
fs.ServeHTTP(w, r)
|
||||
}))
|
||||
}
|
||||
|
||||
// Create server
|
||||
srv := &http.Server{
|
||||
Addr: ":" + cfg.Port,
|
||||
|
||||
Reference in new issue
Block a user