DefinitelyTyped/types/http-server/index.d.ts
York Yao b4b8c2f7d3 add types of http-server (#20394)
* add types of http-server

* add strictFunctionTypes

* fix lint
2017-10-09 15:36:57 -07:00

31 lines
985 B
TypeScript

// Type definitions for http-server 0.10
// Project: https://github.com/indexzero/http-server#readme
// Definitions by: York Yao <https://github.com/plantain-00>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
import * as http from "http";
import * as https from "https";
import { HandleFunction } from "connect";
export function createServer(options?: Options): http.Server | https.Server;
export interface Options {
root?: string;
headers?: { [name: string]: string };
cache?: number;
showDir?: boolean | "false";
autoIndex?: boolean | "false";
showDotfiles?: boolean;
gzip?: boolean;
contentType?: string;
ext?: boolean;
before?: HandleFunction[];
// tslint:disable-next-line prefer-method-signature
logFn?: (req: http.IncomingMessage, res: http.ServerResponse, err: Error) => void;
cors?: boolean;
corsHeaders?: string;
robots?: string | true;
proxy?: string;
https?: https.ServerOptions;
}