fix: allow app to build without UI dist directory

Add a placeholder README.md in app/ui/app/dist so the go:embed directive
doesn't fail when the UI hasn't been built. Also improve the error message
when index.html is not found to help developers understand they need to
run 'npm run build'.
This commit is contained in:
jmorganca
2026-02-07 15:15:53 -08:00
parent 099a0f18ef
commit 03f56d3c30
2 changed files with 5 additions and 1 deletions

View File

@@ -33,7 +33,10 @@ func (s *Server) appHandler() http.Handler {
data, err := fs.ReadFile(fsys, "index.html")
if err != nil {
if errors.Is(err, fs.ErrNotExist) {
http.NotFound(w, r)
// Development mode: UI not built
w.Header().Set("Content-Type", "text/plain")
w.WriteHeader(http.StatusNotFound)
w.Write([]byte("UI not built. Run 'npm run build' in app/ui/app directory."))
} else {
http.Error(w, "Internal Server Error", http.StatusInternalServerError)
}

1
app/ui/app/dist/README.md vendored Normal file
View File

@@ -0,0 +1 @@
This directory contains the built React app. Run `npm run build` in the app directory to generate the build.