Expand description

Utilities for working with the server. These are fairly low-level, and are intended for use by those developing new server integrations. This module contains the necessary primitives to run Perseus as a server, regardless of framework. This module aims to provide as many abstractions as possible to minimize work when maintaining multiple server-framework integrations. Apart from building your own integrations, you should never need to use this module (though some plugins may need types in here).

Structs

The properties required to get data for a page.

The shell used to interpolate the Perseus app into, including associated scripts and content defined by the user, components of the Perseus core, and plugins.

The options for setting up all server integrations. This should be literally constructed, as nothing is optional. If integrations need further properties, they should expose their own options in addition to these.

The full set of properties that all server integrations take.

Functions

Prepares an HTML error page for the client, with injected markers for hydration. In the event of an error, this should be returned to the client (with the appropriate status code) to allow Perseus to hydrate and display the correct error page. Note that this is only for use in initial loads (other systems handle errors in subsequent loads, and the app shell exists then so the server doesn’t have to do nearly as much work).

Gets the HTML/JSON data for the given page path. This will call SSG/SSR/etc., whatever is needed for that page.

Internal logic behind get_page. The only differences are that this takes a full template rather than just a template name, which can avoid an unnecessary lookup if you already know the template in full (e.g. initial load server-side routing). Because this handles templates with potentially revalidation and incremental generation, it uses both mutable and immutable stores.

Removes empty elements from a path, which is important due to double slashes. This returns a vector of the path’s components;

Gets the configuration of how to render each page using an immutable store.