76a281a0
server: embed web SPA at /, wire build pipeline
- Add internal/server/web/embed.go with //go:embed all:dist and a
SPA fallback shim: file-not-found → serve index.html at 200.
- Commit dist/.gitkeep and dist/index.html (placeholder) so go build
works on a fresh clone; real build output stays gitignored.
- Mount web.Handler() as GET /* catch-all in server.go after /api/v1
so API routes and probe endpoints shadow the wildcard.
- Add three server tests: ServesSPAAtRoot, SPAFallbackForNonAPIPath,
APIPathsBypassSPA; update NotFoundReturnsProblemJSON for SPA era.
- Extend Justfile with web-{install,dev,build,test,lint,clean} targets;
build now depends on web-build.
- Add node:20-alpine web-builder stage to Dockerfile; COPY dist into
the Go builder stage before compiling.
Eugene Blikh <bigbes@gmail.com> — 2026-04-26 03:39:41 UTC
Commit 76a281a0eca48e3ecdafe1663d5fb7ac68286a5f —
view raw patch
Parent(s):
f903c872
| File | Status | + | − |
|---|---|---|---|
.gitignore
|
M | +1 | |
Dockerfile
|
M | +9 | |
Justfile
|
M | +21 | -1 |
internal/server/server.go
|
M | +9 | |
internal/server/server_test.go
|
M | +107 | -2 |
internal/server/web/dist/.gitkeep
BIN
|
A | ||
internal/server/web/dist/index.html
|
A | +1 | |
internal/server/web/embed.go
|
A | +95 | |
web/vite.config.ts
|
M | +5 | -1 |