You've already forked agentic-coding-workflow
feat(server): embed SPA dist with fallback handler; single-binary deploy
This commit is contained in:
@@ -17,6 +17,9 @@ type RouterDeps struct {
|
||||
HealthCheck func(*http.Request) error
|
||||
// ReadyCheck is invoked from GET /readyz with the same contract.
|
||||
ReadyCheck func(*http.Request) error
|
||||
// SPAHandler 为 nil 时禁用前端 fallback;非 nil 时挂到 chi NotFound,
|
||||
// 把未匹配的请求交给 SPA handler 处理(静态文件 + index.html 回退)。
|
||||
SPAHandler http.Handler
|
||||
}
|
||||
|
||||
// NewRouter builds the application's chi.Router with the standard
|
||||
@@ -46,5 +49,9 @@ func NewRouter(deps RouterDeps) chi.Router {
|
||||
_, _ = w.Write([]byte("ok"))
|
||||
})
|
||||
|
||||
if deps.SPAHandler != nil {
|
||||
r.NotFound(deps.SPAHandler.ServeHTTP)
|
||||
}
|
||||
|
||||
return r
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user