IResponse
the response object inherits from http.ServerResponse
#
Usage#
status#
status(code: number): IResponseset response status code
#
contentType#
contentType(type: string): IResponseset response content type
#
header#
header(key: string, value: string): IResponse#
set(key: string, value: string): IResponseset response header
#
cache#
res.cache(seconds: number): IResponseset Cache-Control header in seconds
#
gzip#
gzip(): IResponsecompress the response with gzip and set Content-Encoding header to gzip
#
redirect#
redirect(path: string): voidredirect the request to new path
#
cookie#
cookie(key: string, value: any, options?: cookie.CookieSerializeOptions): IResponsesets cookie name to value. The value parameter may be a string or object converted to JSON.
#
clearCookie#
clearCookie(key: string, options?: cookie.CookieSerializeOptions): IResponseclears the cookie specified by name.
#
cache#
cache(seconds: number)add Cache-Control header
#
json#
json(obj: object)sends a JSON response.
#
jsonp#
jsonp(obj: object)Sends a JSON response with JSONP support. This method is identical to res.json(), except that it opts-in to JSONP callback support
#
send#
send(data?: string | Buffer| object)send data response