cassava
Version:
AWS API Gateway Router
42 lines (41 loc) • 1.35 kB
TypeScript
import { Route } from "./Route";
import { RouterEvent } from "../RouterEvent";
import { RouterResponse } from "../RouterResponse";
export declare class FileSystemRoute implements Route {
readonly config: FileSystemRouteConfig;
private static readonly mimeTypes;
constructor(config: FileSystemRouteConfig);
matches(evt: RouterEvent): boolean;
handle(evt: RouterEvent): Promise<RouterResponse>;
private getMimeType;
}
export interface FileSystemRouteConfig {
/**
* The root of the rest path the files will be hosted from.
*/
restPath: string;
/**
* The directory on the file system where the files are located.
*/
fsPath: string;
/**
* Optional list of file extensions to blacklist. If set any files
* with extensions in this list will not be served. `fileExtensionWhitelist`
* is the more secure option.
*/
fileExtensionBlacklist?: string[];
/**
* Optional list of file extensions to whitelist. If set any files
* with extensions *not* in this list will not be served.
*/
fileExtensionWhitelist?: string[];
/**
* Optional additional mime-types. Structure is a map of file extension
* (including `.`) to mime-type.
*
* eg: {".foo": "text/foo"}
*/
mimeTypes?: {
[ext: string]: string;
};
}