-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathindex.d.ts
65 lines (54 loc) · 1.92 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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
import { Express, Request, Response, Handler, Locals } from 'express';
import { CompressionOptions } from 'compression';
import { Options as RoutingOptions } from 'express-file-routing';
import { HelmetOptions } from 'helmet';
import { Options as SirvOptions } from 'sirv';
import { ProxyOptions as HttpProxyOptions } from 'express-http-proxy';
import csurf from 'csurf';
import { CorsOptions } from 'cors';
import { SessionOptions as SessionMiddlewareOptions } from 'express-session';
export interface ApiOptions extends RoutingOptions {
dir?: RoutingOptions['directory'];
method?: (req: Request, res: Response) => string | string;
reqId?: string;
}
export interface SecurityOptions extends HelmetOptions {
secure?: boolean;
cors?: CorsOptions | boolean;
csrf?: Parameters<typeof csurf> | boolean;
}
export interface StaticOptions extends SirvOptions {
dir?: string;
}
export interface ProxyOptions extends HttpProxyOptions {
target: string | ((req: Request) => string);
path?: string;
}
export interface SsrOptions {
handler: ((req: Request) => Promise<Record<string, string>>);
template?: string | ((req: Request) => string);
}
export interface SseOptions {
path?: string;
headers?: Record<string, string>;
statusCode?: number;
compress?: boolean;
retry?: number;
serializer?: Parameters<typeof JSON.stringify>[1] | ((this: any, key: string, value: any) => any);
}
export interface SessionOptions extends SessionMiddlewareOptions {
persist?: boolean;
dir?: string;
}
export interface Options {
security: SecurityOptions | false;
compress: CompressionOptions | false;
static: StaticOptions | false;
session: SessionOptions | false;
sse: SseOptions | false;
middlewares: Handler[] | false;
api: ApiOptions | false;
proxy: ProxyOptions | false;
ssr: SsrOptions | false;
}
export declare function bff(app: Express, options: Options): void;