UNPKG

@paroicms/server

Version:
30 lines (29 loc) 1.41 kB
import type { PaHttpContext } from "@paroicms/public-server-lib"; import type { Request } from "express"; import type { MigrationSiteContext, SiteContext } from "../site-context/site-context.types.js"; declare module "express" { interface Request { paSiteContext?: SiteContext | MigrationSiteContext; } } export declare function getPaSiteContext(req: Request): SiteContext | MigrationSiteContext; export declare function getRouteParameter(params: Record<string, string | undefined>, parameterName: string): string; export declare function getRouteParameter(params: Record<string, string | undefined>, parameterName: string, options: { optional: true; }): string | undefined; export declare function serveTextContent(httpContext: PaHttpContext, { status, contentType, text, or304, }: { status?: number; contentType?: string; text: string; or304?: { etag: string; }; }): void; export declare function serve500Html(httpContext: PaHttpContext): void; export declare function serve404SimpleHtml(httpContext: PaHttpContext): void; export declare function serve304NotModified(httpContext: PaHttpContext, headers: { cacheControl: string; etag: string; }): void; export declare function serve301Redirect(httpContext: PaHttpContext, redirectTo: string): void; export declare function serve503ServiceUnavailable(httpContext: PaHttpContext, message?: string): void;