initial commit

This commit is contained in:
Daniel Noulet 2026-10-07 15:03:50 +02:00
commit 23816d00f7
71 changed files with 14497 additions and 0 deletions

View file

@ -0,0 +1,33 @@
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8" />
<title>go-doc &middot; frontend not built</title>
<style>
body {
margin: 0;
min-height: 100vh;
display: grid;
place-items: center;
background: #0b0f14;
color: #cbd5e1;
font: 16px/1.6 ui-monospace, SFMono-Regular, Menlo, monospace;
}
main { max-width: 46rem; padding: 3rem; }
h1 { color: #f8fafc; font-size: 1.6rem; }
code { color: #7dd3fc; }
ul { padding-left: 1.2rem; }
</style>
</head>
<body>
<main>
<h1>go-doc API is running</h1>
<p>This is the placeholder page shipped with the Go binary. The React bundle has not been compiled into it yet.</p>
<ul>
<li>Run <code>make frontend-run</code> for the Vite dev server on port 5173.</li>
<li>Run <code>make build</code> to embed the production bundle into the binary.</li>
</ul>
<p>API: <code>/api/health</code> &middot; <code>/api/docs</code> &middot; <code>/api/docs/{slug}</code> &middot; <code>/api/docs/{slug}/comments</code></p>
</main>
</body>
</html>

14
backend/webui/dist/index.html vendored Normal file
View file

@ -0,0 +1,14 @@
<!doctype html>
<html lang="en" class="dark">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta name="description" content="go-doc — segmented documentation and audience feedback for users, operators and developers" />
<title>Go Doc: Application Documentation tool.</title>
<script type="module" crossorigin src="/assets/index-76KU_cS9.js"></script>
<link rel="stylesheet" crossorigin href="/assets/index-fwxz_0Za.css">
</head>
<body>
<div id="root"></div>
</body>
</html>

31
backend/webui/embed.go Normal file
View file

@ -0,0 +1,31 @@
// Package webui embeds the compiled React bundle produced by `make build`.
//
// The `dist` directory is populated by the build pipeline (npm run build copies
// frontend/dist into backend/webui/dist). A placeholder index.html is checked
// in so the backend always compiles and runs, even in a fresh checkout where
// the frontend has not been built yet.
package webui
import (
"embed"
"io/fs"
)
//go:embed all:dist
var assets embed.FS
// FS returns the root of the embedded bundle, or nil when the placeholder build
// is still in place and no real frontend bundle has been compiled.
func FS() fs.FS {
sub, err := fs.Sub(assets, "dist")
if err != nil {
return nil
}
if _, err := fs.Stat(sub, "index.html"); err != nil {
return nil
}
return sub
}
// Assets exposes the raw embedded filesystem, including the dist prefix.
func Assets() fs.FS { return assets }