runtime

package
v0.1.0-alpha.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 23, 2026 License: MIT Imports: 25 Imported by: 0

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 APIRoute

type APIRoute struct {
	Route   router.Route
	Methods map[string]gb.Handler
}

type Action

type Action struct {
	ID      string
	MaxBody int64
	// contains filtered or unexported fields
}

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

type PublicOriginResolver func(*http.Request) (string, error)

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 Server

type Server struct {
	// contains filtered or unexported fields
}

func New

func New(config Config) (*Server, error)

func (*Server) ServeHTTP

func (s *Server) ServeHTTP(writer http.ResponseWriter, request *http.Request)

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

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL