@paroicms/server
Version:
The ParoiCMS server
33 lines (32 loc) • 1.45 kB
TypeScript
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 interface PaRouteParams {
[key: string]: string | string[] | undefined;
}
export declare function getRouteParameter(params: PaRouteParams, parameterName: string): string;
export declare function getRouteParameter(params: PaRouteParams, 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;