@prostory/mountain
Version:
Yet another HTTP/2 server and client.
18 lines (17 loc) • 610 B
TypeScript
import { Request } from '../types';
export interface ResponseBuilder {
/** Sends response to client. */
end: () => void;
/** Define chunks of body to be sent to client. */
body: (chunk: string) => ResponseBuilder;
/** Sends JSON to client. */
json: (payload: object) => void;
/**
* Sends file to client. _path_ should be an
* absolute path to file.
*/
file: (path: string) => void;
/** Define a header for response. */
header: (name: string, value: string) => ResponseBuilder;
}
export declare const responseFor: ({ stream }: Request) => ResponseBuilder;