UNPKG

@scaffoldly/serverless-util

Version:
25 lines 1.15 kB
import cors from 'cors'; import { Express, NextFunction, Request, Response } from 'express'; declare type StaticOrigin = boolean | string | RegExp | (string | RegExp)[]; declare type CustomOrigin = (requestOrigin: string | undefined, callback: (err: Error | null, origin?: StaticOrigin) => void) => void; export interface CorsOptions { headers?: string[]; withCredentials?: boolean; maxAge?: number; origin?: StaticOrigin | CustomOrigin; } export declare const createApp: ({ logHeaders }?: { logHeaders?: boolean | undefined; }) => Express; export declare function corsHandler(options?: CorsOptions): (req: cors.CorsRequest, res: { statusCode?: number; setHeader(key: string, value: string): any; end(): any; }, next: (err?: any) => any) => void; export declare function errorHandler(version: string): (err: Error | any, req: Request, res: Response, next: NextFunction) => Response | void; export declare const registerDocs: (app: Express, swaggerJson: { [key: string]: any; }) => void; export declare const registerVersion: (app: Express, version: string) => void; export {}; //# sourceMappingURL=express.d.ts.map