/// /** * @module server */ /** End Typedoc Module Declaration */ import { EventEmitter } from 'events'; /** * Response class that is passed into all middleware and controller methods to be manipulated * and eventually dispatched to the client. * * Response is also an `EventEmitter` so you can attach listeners to the response: * * [[Response.EVENT_DATA]] * * [[Response.EVENT_END]] * */ export declare class Response extends EventEmitter { /** @event Emitted when response body data is set */ static EVENT_DATA: string; /** @event Emitted when response body setting is completed */ static EVENT_END: string; /** The HTTP status code that is sent */ statusCode: number; /** Custom message (if any) associated with custom status codes */ statusMessage: string; /** Map of headers to send back */ headers: Map; /** Body content, should almost always be JSON */ body: any; /** * Set the data to be sent back in the body. * This also emits a `data` event containing the response body and immediately sends `end` event * @param data * @returns {Response} */ data(data: any): this; /** * Set the status code to be sent * @param code * @returns {Response} */ status(code: number): this; /** * Add or overwrite a header * @param name * @param value * @returns {Response} */ header(name: string, value: string): this; /** * Utility method to send the correct status code for created entity * @param data * @returns {Response} */ created(data: any): this; }