Served the frontend's build output from server.frontend.dir
internal/frontend serves a Vite build from an fs.FS: hashed files under /assets/ are cached for a year, HTML and other files get no-cache, ETags are computed (and cached for a build that can't change), precompressed variants are served when the client accepts them, and a path without an extension falls back to index.html for client-side routes. Only GET and HEAD are allowed. server.WithFrontend serves it for every path outside /api and /ws, behind compression and the frontend group's hooks. job-search serve passes the directory in server.frontend.dir, checked for an index.html at start; empty means no frontend. Its option building moved into serverOptions, with the access log.
This commit is contained in:
1 parent
155b84caea
commit
9905ffb4cb
7 files changed
+430
-36
No files matched your search
@@ -7,11 +7,12 @@ import (
|
||||
// JSCKServerFrontend is the frontend section's configuration key.
|
||||
const JSCKServerFrontend string = "frontend"
|
||||
|
||||
// JSCServerFrontend configures how the server serves the frontend. Nothing
|
||||
// reads it yet. Dir serves the frontend from disk instead of the embedded
|
||||
// build; empty means the embedded build. ImmutablePrefix is where Vite emits
|
||||
// content-hashed files, and IndexCacheControl the Cache-Control of HTML and
|
||||
// other files without a hash; empty means none.
|
||||
// JSCServerFrontend configures how the server serves the frontend. Dir is
|
||||
// the directory of the frontend's build output (holding index.html); empty
|
||||
// means no frontend is served, as there is no embedded build yet.
|
||||
// ImmutablePrefix is where Vite emits content-hashed files, cached for a
|
||||
// year; empty means "/assets/". IndexCacheControl is the Cache-Control of
|
||||
// HTML and other files without a hash; empty means "no-cache".
|
||||
type JSCServerFrontend struct {
|
||||
Dir string `cfg:"dir"`
|
||||
ImmutablePrefix string `cfg:"immutable_prefix"`
|
||||
|
||||
Reference in new issue
Block a user