UNPKG

950 BTypeScriptView Raw
1/// <reference types="node" />
2
3import { Url } from "url";
4
5import * as core from "express-serve-static-core";
6
7export = historyApiFallback;
8
9declare function historyApiFallback(options?: historyApiFallback.Options): core.RequestHandler;
10
11declare namespace historyApiFallback {
12 interface Options {
13 readonly disableDotRule?: true | undefined;
14 readonly htmlAcceptHeaders?: readonly string[] | undefined;
15 readonly index?: string | undefined;
16 readonly logger?: typeof console.log | undefined;
17 readonly rewrites?: readonly Rewrite[] | undefined;
18 readonly verbose?: boolean | undefined;
19 }
20
21 interface Context {
22 readonly match: RegExpMatchArray;
23 readonly parsedUrl: Url;
24 readonly request: core.Request;
25 }
26 type RewriteTo = (context: Context) => string;
27
28 interface Rewrite {
29 readonly from: RegExp;
30 readonly to: string | RegExp | RewriteTo;
31 }
32}