Skip to main content
Using Deno in production at your company? Earn free Deno merch.
Give us feedback
Go to Latest
class PageGenerator
import { PageGenerator } from "https://deno.land/x/frugal@0.5.0/packages/core/mod.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)