mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2025-10-16 12:05:41 +00:00
* Revert "Express: improve type of `Request['params']` aka `req.params` (#37502)"
This reverts commit 9aa863ef23.
* Express: use generics for params, default to dictionary
* Lint
* Bump all dependants
* Spacing
* Bump dependants
* Bump dependants
* Bump dependants
* Bump dependants
* Bump dependants
* Bump dependants
* Bump dependants
* Bump dependants
* Bump dependants
* Bump dependants
* Bump dependants (via tests)
* Bump dependants
* Bump dependants (via tests)
* Bump dependants
* Simplify test
* Hoist imports
* Tidy test
* Add tests
* Add reasons
* Remove redundant params
* Add tests
* Format
* Remove redundant params
* Add tests
* Add JSDoc
* Improve comment
* Improve comment
50 lines
1.4 KiB
TypeScript
50 lines
1.4 KiB
TypeScript
// Type definitions for apimocker 1.1
|
|
// Project: https://www.npmjs.com/package/apimocker
|
|
// Definitions by: Uchenna <https://github.com/uchilaka>
|
|
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
|
// TypeScript Version: 2.3
|
|
|
|
import { RequestHandler, Application } from 'express';
|
|
|
|
export interface ConfigOptions {
|
|
port?: string;
|
|
mockDirectory?: string;
|
|
allowedDomains?: string[];
|
|
allowedHeaders?: string[];
|
|
logRequestHeaders?: boolean;
|
|
allowAvoidPreFlight?: boolean;
|
|
useUploadFieldname?: boolean;
|
|
webServices?: any;
|
|
quiet?: boolean;
|
|
}
|
|
|
|
export interface ApiMocker {
|
|
express: Application;
|
|
middlewares: RequestHandler[];
|
|
setConfigFile: (file: string) => ApiMocker;
|
|
loadConfigFile: () => void;
|
|
setRoutes: (webServices: any) => void;
|
|
/**
|
|
* Set the route for express, in case it was not set yet
|
|
*/
|
|
setRoute: (options: any) => void;
|
|
/**
|
|
* Start a new instance of API Mocker
|
|
*/
|
|
start: (serverPort: string | number, callback?: () => void) => ApiMocker;
|
|
/**
|
|
* Stop the referenced instance of API Mocker
|
|
*/
|
|
stop: (callback?: () => void) => ApiMocker;
|
|
}
|
|
|
|
export const middlewares: RequestHandler[];
|
|
|
|
export function createServer(options?: ConfigOptions): ApiMocker;
|
|
|
|
export function setConfigFile(file: string): ApiMocker;
|
|
|
|
export function start(serverPort: string | number, callback?: () => void): ApiMocker;
|
|
|
|
export function stop(callback?: () => void): ApiMocker;
|