@breautek/storm
Version:
Object-Oriented REST API framework
29 lines (28 loc) • 1.1 kB
TypeScript
import { Middleware } from './Middleware';
import { Request } from './Request';
import { Response } from './Response';
import { IRequestResponse } from './IRequestResponse';
/**
* CORSMiddleware is used to enable CORS on APIs.
* It will automatically add the necessary headers necessary to
* communicate with CORS enabled clients.
*/
export declare class CORSMiddleware extends Middleware {
private $allowedOrigin;
private $allowedHeaders;
private $allowedMethods;
/**
* @constructor
* @param allowedOrigin The allowed origin. By default it will use the request origin.
* @param allowedHeaders Array of allowed headers.
* @param allowedMethods Array of allowed HTTP methods.
*/
constructor(allowedOrigin?: string, allowedHeaders?: string[], allowedMethods?: string[]);
/**
* Sets the allowed origin. By default,
*/
getDefaultAllowedOrigin(): string;
getDefaultAllowedHeaders(): string[];
getDefaultAllowedMethods(): string[];
protected _execute(request: Request, response: Response): Promise<IRequestResponse>;
}