You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
38 lines
1.0 KiB
38 lines
1.0 KiB
|
3 years ago
|
// Type definitions for connect-history-api-fallback 1.3
|
||
|
|
// Project: https://github.com/bripkens/connect-history-api-fallback#readme
|
||
|
|
// Definitions by: Douglas Duteil <https://github.com/douglasduteil>
|
||
|
|
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||
|
|
// TypeScript Version: 2.3
|
||
|
|
|
||
|
|
/// <reference types="node" />
|
||
|
|
|
||
|
|
import { Url } from 'url';
|
||
|
|
|
||
|
|
import * as core from "express-serve-static-core";
|
||
|
|
|
||
|
|
export = historyApiFallback;
|
||
|
|
|
||
|
|
declare function historyApiFallback(options?: historyApiFallback.Options): core.RequestHandler;
|
||
|
|
|
||
|
|
declare namespace historyApiFallback {
|
||
|
|
interface Options {
|
||
|
|
disableDotRule?: true;
|
||
|
|
htmlAcceptHeaders?: string[];
|
||
|
|
index?: string;
|
||
|
|
logger?: typeof console.log;
|
||
|
|
rewrites?: Rewrite[];
|
||
|
|
verbose?: boolean;
|
||
|
|
}
|
||
|
|
|
||
|
|
interface Context {
|
||
|
|
match: RegExpMatchArray;
|
||
|
|
parsedUrl: Url;
|
||
|
|
}
|
||
|
|
type RewriteTo = (context: Context) => string;
|
||
|
|
|
||
|
|
interface Rewrite {
|
||
|
|
from: RegExp;
|
||
|
|
to: string | RegExp | RewriteTo;
|
||
|
|
}
|
||
|
|
}
|