UNPKG

765 BTypeScriptView Raw
1/// <reference types="node" />
2import { ServerResponse, IncomingMessage } from 'http';
3export declare type NowRequestCookies = {
4 [key: string]: string;
5};
6export declare type NowRequestQuery = {
7 [key: string]: string | string[];
8};
9export declare type NowRequestBody = any;
10export declare type NowRequest = IncomingMessage & {
11 query: NowRequestQuery;
12 cookies: NowRequestCookies;
13 body: NowRequestBody;
14};
15export declare type NowResponse = ServerResponse & {
16 send: (body: any) => NowResponse;
17 json: (jsonBody: any) => NowResponse;
18 status: (statusCode: number) => NowResponse;
19 redirect: (statusOrUrl: string | number, url?: string) => NowResponse;
20};
21export declare type NowApiHandler = (req: NowRequest, res: NowResponse) => void;