mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-07-10 20:20:12 +00:00
* (lib) initial source for @types/apimocker
* (test) typical, documented use case
* (cleanup) prep for PR
* (apimocker) updates
* (apimocker) fixed sample code
* (apimocker:refactor) fixes from linting notes
* (apimocker:check) generated with dts-gen & tweaked
* (apimocker:build) wip to fix CI build
* (apimocker:build) fixed header formatting
* (apimocker:build) removed .gitignore
* (apimocker:build) tweaks
* (apimocker:wip) tslint.json issues
* (apimocker:build) added package.json & ts3.1/*
* (apimocker:refactor) tweaks to fix build
* (apimocker:build) removed offending test
* (apimocker:build) Removed unused file
* (apimocker:refactor) more build fixes 😭
* (feedback) cleanup comments & removed package.json
* (feedback) more tweaks from review notes
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.2
|
|
|
|
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;
|