feat(adminui): embed the admin SPA and serve it next to the API
- Add internal/adminui with a SPA handler: index fallback for client routes, immutable caching for hashed assets, 404 for missing assets, security headers - Answer 503 with a hint when the UI has not been built, so go build always works - Mount the UI at / and the API at /api/ on the same listener, no CORS needed - Scaffold admin/ with Vite, React, TypeScript, Tailwind v4, shadcn/ui and Vitest
This commit is contained in:
parent
48c7124fcf
commit
5a0dd7f6d6
1 changed files with 7740 additions and 1 deletions
8
admin/scripts/clean.mjs
Normal file
8
admin/scripts/clean.mjs
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
// Empties the Go embed directory but keeps .gitkeep, so `go build` always works.
|
||||
import { readdirSync, rmSync } from 'node:fs'
|
||||
import { join } from 'node:path'
|
||||
|
||||
const dist = new URL('../../internal/adminui/dist', import.meta.url).pathname
|
||||
for (const name of readdirSync(dist)) {
|
||||
if (name !== '.gitkeep') rmSync(join(dist, name), { recursive: true, force: true })
|
||||
}
|
||||
Loading…
Reference in a new issue