1 |
|
2 | import { Request, Response, NextFunction } from 'express';
|
3 | export interface AnyErrorDuck extends Error {
|
4 | code?: string;
|
5 | status?: number;
|
6 | [key: string]: any;
|
7 | }
|
8 | export type ServeFunction = (req: Request, res: Response) => void;
|
9 | export type MiddlewareFunction = (req: Request, res: Response, next: NextFunction) => void;
|
10 | export type TransformPromiseFromFileName = ((fileName: string) => Promise<any>);
|
11 | export declare let globalOpts: {
|
12 | serveErr: {
|
13 | propertiesWhiteList: string[];
|
14 | sendStack: boolean;
|
15 | };
|
16 | logServe: boolean;
|
17 | readConfig: {
|
18 | exts: {
|
19 | [key: string]: TransformPromiseFromFileName;
|
20 | };
|
21 | };
|
22 | };
|
23 | export declare function serveErr(_req: Request, res: Response, next: NextFunction): (err: AnyErrorDuck) => Promise<void>;
|
24 | export type IdentsMap = {
|
25 | [key: string]: boolean;
|
26 | };
|
27 | export declare function preEval(expresion: string, vars: IdentsMap, functions: IdentsMap): boolean;
|
28 | export declare function serveBuffer(buf: Buffer, headers: [type: string, value: string][]): ServeFunction;
|
29 | export declare function serveImage(imageBuffer: Buffer, headers: [type: string, value: string][]): ServeFunction;
|
30 | export declare function serveText(htmlText: string, contentTypeText: string): ServeFunction;
|
31 | export declare function serveFile(fileName: string, options: object): ServeFunction;
|
32 | export declare function escapeRegExp(string: string): string;
|
33 | export declare function getTraceroute(): string;
|
34 | export declare function serveStylus(pathToFile: string, anyFile: boolean): MiddlewareFunction;
|
35 | export declare function serveJade(pathToFile: string, anyFileOrOptions: boolean): MiddlewareFunction;
|
36 | export declare function serveJson(object: any): MiddlewareFunction;
|
37 | export declare function serveYaml(object: any): MiddlewareFunction;
|
38 | export declare function readConfig<T>(listOfFileNamesOrConfigObjects: (string | T)[], opts?: {
|
39 | whenNotExist?: 'ignore';
|
40 | }): Promise<T>;
|