Sign in

Type: MonoCloudResponse

Represents an outgoing HTTP response with common helper methods.

Methods

done()

done(): any

Finalizes and returns the response.

Returns

any


internalServerError()

internalServerError(): void

Sends a 500 Internal Server Error response.

Returns

void


methodNotAllowed()

methodNotAllowed(): void

Sends a 405 Method Not Allowed response.

Returns

void


noContent()

noContent(): void

Sends a 204 No Content response.

Returns

void


notFound()

notFound(): void

Sends a 404 Not Found response.

Returns

void


redirect()

redirect(url: string, statusCode?: number): void

Redirects the client to the specified URL.

Parameters

ParameterTypeDescription
urlstringThe URL to redirect to.
statusCode?numberThe HTTP status code to use for the redirect.

Returns

void


sendJson()

sendJson(data: any, statusCode?: number): void

Sends a JSON response with an optional status code.

Parameters

ParameterTypeDescription
dataanyThe data to serialize and send as JSON.
statusCode?numberThe HTTP status code for the response.

Returns

void


setCookie()

setCookie(cookieName: string, value: string, options: CookieOptions): Promise<void>

Sets a cookie on the response.

Parameters

ParameterTypeDescription
cookieNamestringThe name of the cookie to set.
valuestringThe value to assign to the cookie.
optionsCookieOptionsSerialization options for the cookie.

Returns

Promise<void>

Inherited from

IMonoCloudCookieResponse.setCookie


setNoCache()

setNoCache(): void

Sets cache-control headers to prevent caching.

Returns

void

© 2024 MonoCloud. All rights reserved.