One Binary, Two Worlds
One deployable
Lesson 5 of 5
vite build emits dist/, //go:embed bakes it into the binary, a fallback route serves index.html for unknown non-API paths, and CGO_ENABLED=0 ships it all as one file.
What you'll learn
- Embed the Vite production build into the Go binary with //go:embed
- Serve static assets and an index.html SPA fallback — without swallowing API 404s
- Ship the whole app as one CGO_ENABLED=0 binary
Members only
A free account unlocks this lesson and every other one.
Runnable challenges, knowledge checks, and progress that syncs across your devices. No card needed.
Not sure yet? Try the free lesson first: The shape of the app