/
index.d.ts
34 lines (30 loc) · 1.04 KB
/
index.d.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
// Type definitions for cors 2.8
// Project: https://github.com/troygoode/node-cors/
// Definitions by: Alan Plum <https://github.com/pluma>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.3
import express = require('express');
type CustomOrigin = (
requestOrigin: string | undefined,
callback: (err: Error | null, allow?: boolean) => void
) => void;
declare namespace e {
interface CorsOptions {
origin?: boolean | string | RegExp | (string | RegExp)[] | CustomOrigin;
methods?: string | string[];
allowedHeaders?: string | string[];
exposedHeaders?: string | string[];
credentials?: boolean;
maxAge?: number;
preflightContinue?: boolean;
optionsSuccessStatus?: number;
}
type CorsOptionsDelegate = (
req: express.Request,
callback: (err: Error | null, options?: CorsOptions) => void
) => void;
}
declare function e(
options?: e.CorsOptions | e.CorsOptionsDelegate
): express.RequestHandler;
export = e;