/// import * as http from 'http'; import { NextFunction } from 'connect'; /** * All templates must be listed here * TODO: maybe have this as a parameter? */ declare const templateConfigs: { success: { file: string; }; error: { file: string; }; metadata: { file: string; }; }; declare type TemplateName = keyof typeof templateConfigs; /** * Should probably be created only once, then passed around to all middlewares that need it. */ export declare type AssetEngine = { /** * Get the result of a template rendering as a string. Probably only useful for tests. */ applyTemplate: (templateName: TemplateName, data: Dictionary) => Promise; /** * Render a template and use it as the HTTP response. */ sendTemplate: (templateName: TemplateName, data: Dictionary, statusCode: number, res: http.ServerResponse, next: NextFunction) => void; /** * Serve a static file. */ sendStatic: (staticFile: string, statusCode: number, res: http.ServerResponse, next: NextFunction) => void; /** * Send a JSON response. This function is dumb, it assumes the 'response' object is someting * that can be turned into a JSON string */ sendJson: (response: Record, statusCode: number, res: http.ServerResponse) => void; }; export declare const load: (assetsRoot: string) => Promise; export {};