Skip to content

Latest commit

 

History

History
72 lines (53 loc) · 1.75 KB

File metadata and controls

72 lines (53 loc) · 1.75 KB

HTTP Server and Runtime

What This Feature Does

httpserver.NewApp(...) is the default runtime entrypoint. It mounts the generated App Bundle, applies i18n middleware when configured, serves static assets and public files by convention, exposes the health endpoint, and routes discovery endpoints.

Modules

  • framework/httpserver

Happy Path

The normal server setup is:

handler, err := httpserver.NewApp(httpserver.Config[*runtime.Context]{
	App: generated.Bundle(appContext),
})
if err != nil {
	return err
}

Convention defaults:

  • static manifest: web/assets-build/manifest.json
  • static prefix: /_assets/
  • public files: web/public
  • health endpoint: /healthz

Focused Example

Use Custom Config only when you need app-owned hooks around the default runtime:

handler, err := httpserver.NewApp(httpserver.Config[*runtime.Context]{
	App: generated.Bundle(appContext),
	Custom: httpserver.CustomConfig{
		MainMiddlewares: []func(http.Handler) http.Handler{
			requestIDMiddleware,
		},
	},
})
if err != nil {
	return err
}

Custom Config is the right place for middleware, cache-policy overrides, public-file overrides, or extra routes. It is not where you replace the generated App Bundle.

When To Use Custom Config Or Advanced Composition

Stay on the default path if convention behavior is enough.

Use Custom Config for middleware, cache headers, extra routes, or static/public overrides.

Use Advanced composition only when you need app-owned runtime packages that do not fit the default wiring surface.

Related Docs