UNPKG

1.58 kBTypeScriptView Raw
1export declare function success({ body, json, cors, statusCode, headers, }?: ResponseParameters): ApiResponse;
2export declare function invalid({ body, json, cors, statusCode, headers, }?: ResponseParameters): ApiResponse;
3export declare function custom({ body, json, cors, statusCode, headers }: CustomParameters): ApiResponse;
4export declare function notFound({ body, json, cors, statusCode, headers, }?: ResponseParameters): ApiResponse;
5export declare function notAuthorized({ body, json, cors, statusCode, headers, }?: ResponseParameters): ApiResponse;
6export declare function error({ body, json, cors, statusCode, headers, err, }?: ErrorParameters): ApiResponse;
7export declare function redirect({ url, cors, statusCode, headers }: RedirectParameters): ApiResponse;
8export interface ApiResponse {
9 statusCode: number;
10 headers: {
11 [name: string]: any;
12 };
13 body?: string;
14}
15export interface ResponseParameters {
16 body?: any;
17 json?: boolean;
18 cors?: boolean;
19 statusCode?: number;
20 headers?: {
21 [key: string]: any;
22 };
23}
24export interface CustomParameters {
25 body?: any;
26 json?: boolean;
27 cors?: boolean;
28 statusCode: number;
29 headers?: {
30 [key: string]: any;
31 };
32}
33export interface ErrorParameters {
34 body?: any;
35 json?: boolean;
36 cors?: boolean;
37 statusCode?: number;
38 headers?: {
39 [key: string]: any;
40 };
41 err?: Error;
42}
43export interface RedirectParameters {
44 url: string;
45 cors?: boolean;
46 statusCode?: number;
47 headers?: {
48 [key: string]: any;
49 };
50}