Skip to main content
Deno 2 is finally here 🎉️
Learn more
Go to Latest
class PageGenerator
import { PageGenerator } from "https://deno.land/x/frugal@0.5.0/docs/dep/frugal/core.ts";

Class handling the page generation process.

Constructors

new
PageGenerator(page: Page<PATH, DATA>, config: PageGeneratorConfig)

Type Parameters

optional
PATH extends Record<string, string> = Record<string, string>
optional
DATA = unknown

Methods

generate(request: Request, state: Record<string, unknown>): Promise<{ pagePath: string; content: string; headers: Headers; } | { status: http.Status; headers: Headers; }>

Generate the page given a request object.

Will throw if the request pathname does not match the page pattern.

generateContentFromData(pathname: string, unnamed 1: ContentGenerationContext<DATA, PATH>): Promise<string>

Generate the content of a page form its data and path

getPagePath(pathname: string)