Documentation
¶
Overview ¶
Package runtime provides GoBeyond's Node-free production HTTP server.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Action ¶
func RegisterAction ¶
func RegisterAction[Input, Output any]( id string, decode func(json.RawMessage) (Input, error), validateOutput func(Output) error, handler func(*gb.ActionContext, Input) (Output, error), ) Action
RegisterAction binds a generated input decoder and output validator to a typed application handler. The decoder runs before application code and the validator runs before a successful result can cross the HTTP boundary.
type Config ¶
type Config struct {
BuildID string
PublicOrigin string
ResolvePublicOrigin PublicOriginResolver
AllowedHosts []string
BrowserAssets *browserassets.Manifest
Pages []PageRoute
Actions []Action
APIs []APIRoute
Middleware []gbmiddleware.Rule
CSRF *security.CSRF
Logger *slog.Logger
Deadlines gb.DeadlinePolicy
MaxHeaderSize int
}
type LoadedPage ¶
type LoadedPage struct {
Kind gb.ResultKind `json:"kind"`
Props any `json:"props,omitempty"`
Metadata gb.Metadata `json:"metadata,omitempty"`
Status int `json:"status,omitempty"`
Headers http.Header `json:"headers,omitempty"`
Cache gb.CachePolicy `json:"cache"`
RedirectTo string `json:"redirectTo,omitempty"`
ErrorCode string `json:"errorCode,omitempty"`
Message string `json:"message,omitempty"`
}
type LoadedPageEntry ¶
type LoadedPageEntry struct {
Params map[string]any
Page LoadedPage
}
type PageLoader ¶
type PageLoader func(*gb.PageContext) (LoadedPage, error)
type PageRoute ¶
type PageRoute struct {
Route router.Route
Plan *renderplan.Plan
Load PageLoader
Static *LoadedPage
Indexable bool
ClientScript string
Styles []string
}
type PublicOriginResolver ¶
PublicOriginResolver resolves the canonical absolute origin for a request. It is useful behind trusted reverse proxies and custom-domain front doors. Resolvers must reject hosts they do not recognize.
type StaticStore ¶
type StaticStore struct {
// contains filtered or unexported fields
}
StaticStore is the startup-loaded, packaged build data used for soft navigation and for static pages promoted to the Go origin by middleware.
func LoadStaticStore ¶
func LoadStaticStore(buildPath, contractsPath string) (*StaticStore, error)
func (*StaticStore) Loader ¶
func (s *StaticStore) Loader(routeID string) PageLoader