Documentation
¶
Overview ¶
Package gobeyond defines the public request-time contracts used by GoBeyond page loaders, actions, API handlers, and middleware.
Index ¶
- Constants
- type ActionContext
- type ActionResult
- type Alternate
- type CacheMode
- type CachePolicy
- type DeadlinePolicy
- type Handler
- type JSONLD
- type Metadata
- type Middleware
- type MiddlewareConfig
- type OpenGraph
- type PageContext
- type PageResult
- type RequestContext
- type Response
- type ResultKind
- type Twitter
Constants ¶
View Source
const RenderAPIVersion = "gobeyond.render/v1alpha1"
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ActionContext ¶
type ActionResult ¶
type CachePolicy ¶
type CachePolicy struct {
Mode CacheMode `json:"mode"`
MaxAge int `json:"maxAge,omitempty"`
StaleWhileRevalidate int `json:"staleWhileRevalidate,omitempty"`
StaleIfError int `json:"staleIfError,omitempty"`
}
func PublicRevalidate ¶
func PublicRevalidate(fresh, stale, staleIfError time.Duration) CachePolicy
PublicRevalidate returns a public policy that keeps browser responses stale while allowing shared caches to retain and asynchronously refresh them. Non-positive durations disable their corresponding directive.
func (CachePolicy) HeaderValue ¶
func (p CachePolicy) HeaderValue() string
type DeadlinePolicy ¶
type Handler ¶
type Handler func(*RequestContext) (Response, error)
type JSONLD ¶
JSONLD is serialized by the document renderer with script-safe escaping. Values must be composed solely of JSON-compatible primitives, arrays, and maps.
type Metadata ¶
type Metadata struct {
Lang string `json:"lang"`
Title string `json:"title"`
Description string `json:"description,omitempty"`
Canonical string `json:"canonical,omitempty"`
Robots string `json:"robots,omitempty"`
OpenGraph OpenGraph `json:"openGraph,omitempty"`
Twitter Twitter `json:"twitter,omitempty"`
Alternates []Alternate `json:"alternates,omitempty"`
JSONLD []JSONLD `json:"jsonLd,omitempty"`
}
type Middleware ¶
type MiddlewareConfig ¶
type PageContext ¶
type PageResult ¶
type PageResult[T any] struct { Kind ResultKind `json:"kind"` Props T `json:"props,omitempty"` Metadata Metadata `json:"metadata,omitempty"` Status int `json:"status,omitempty"` Headers map[string]string `json:"headers,omitempty"` Cache CachePolicy `json:"cache"` RedirectTo string `json:"redirectTo,omitempty"` ErrorCode string `json:"errorCode,omitempty"` Message string `json:"message,omitempty"` }
func NotFound ¶
func NotFound[T any](metadata Metadata) PageResult[T]
func OK ¶
func OK[T any](props T, metadata Metadata) PageResult[T]
type RequestContext ¶
type ResultKind ¶
type ResultKind string
const ( ResultOK ResultKind = "ok" ResultRedirect ResultKind = "redirect" ResultNotFound ResultKind = "not_found" ResultPublicError ResultKind = "public_error" ResultInternalError ResultKind = "internal_error" )
Directories
¶
| Path | Synopsis |
|---|---|
|
adapters
|
|
|
lambda
Package lambdaurl adapts an http.Handler to an AWS Lambda Function URL (payload format 2.0) entrypoint.
|
Package lambdaurl adapts an http.Handler to an AWS Lambda Function URL (payload format 2.0) entrypoint. |
|
Package browserassets defines the versioned browser bundle manifest emitted by gobeyond build.
|
Package browserassets defines the versioned browser bundle manifest emitted by gobeyond build. |
|
cmd
|
|
|
gobeyond
command
|
|
|
render-fixture
command
Command render-fixture is a test-only bridge used by cross-language hydration conformance tests.
|
Command render-fixture is a test-only bridge used by cross-language hydration conformance tests. |
|
Package codegen decodes GoBeyond value-contract documents and generates the Go types shared by page loaders and actions.
|
Package codegen decodes GoBeyond value-contract documents and generates the Go types shared by page loaders and actions. |
|
Package document renders the complete SEO and hydration document around a body produced by GoBeyond's portable renderer.
|
Package document renders the complete SEO and hydration document around a body produced by GoBeyond's portable renderer. |
|
examples
|
|
|
seo-site/app/account
Package account owns request-time props for /account.
|
Package account owns request-time props for /account. |
|
seo-site/app/api/time
Package apitime owns the fixture's public /api/time endpoint.
|
Package apitime owns the fixture's public /api/time endpoint. |
|
seo-site/internal/gobeyondgen/routes
Code generated by gobeyond generate; DO NOT EDIT.
|
Code generated by gobeyond generate; DO NOT EDIT. |
|
seo-site/internal/site
Package shared contains the runtime-independent policy shared by the example's typed page loaders.
|
Package shared contains the runtime-independent policy shared by the example's typed page loaders. |
|
seo-site/server
Package seosite wires the website-first React fixture to GoBeyond's Go runtime.
|
Package seosite wires the website-first React fixture to GoBeyond's Go runtime. |
|
seo-site/server/cmd/site
command
|
|
|
imageopt
|
|
|
s3
module
|
|
|
internal
|
|
|
jsvalue
Package jsvalue validates values before Go renders and JSON serializes them for the pinned JavaScript runtime.
|
Package jsvalue validates values before Go renders and JSON serializes them for the pinned JavaScript runtime. |
|
Package middleware composes statically discoverable GoBeyond middleware.
|
Package middleware composes statically discoverable GoBeyond middleware. |
|
Package renderer evaluates GoBeyond rendering plans and emits deterministic HTML without executing JavaScript.
|
Package renderer evaluates GoBeyond rendering plans and emits deterministic HTML without executing JavaScript. |
|
Package renderplan defines the versioned, language-neutral rendering plan consumed by GoBeyond's production renderer.
|
Package renderplan defines the versioned, language-neutral rendering plan consumed by GoBeyond's production renderer. |
|
Package router implements GoBeyond's deterministic route-pattern matching.
|
Package router implements GoBeyond's deterministic route-pattern matching. |
|
Package runtime provides GoBeyond's Node-free production HTTP server.
|
Package runtime provides GoBeyond's Node-free production HTTP server. |
|
Package security contains framework-enforced HTTP boundary protections.
|
Package security contains framework-enforced HTTP boundary protections. |
Click to show internal directories.
Click to hide internal directories.