UNPKG

outers

Version:

outers - a all in one package for your day to day use

34 lines (33 loc) 1.54 kB
import { Response } from "express"; import { CookieType } from "../../Config/Constant/Response.Constant"; /** * Represents a JSON response object that can be sent using Express. */ export default class JSONResponser { #private; /** * Creates a new instance of the JSONResponser class. * @param response The Express response object. * @param StatusCode The HTTP status code to be set. * @param contentType The content type of the response. * @param Title The title of the response (optional). * @param Message The message of the response (optional). * @param CookieData An optional array of objects representing cookie data to be set. */ constructor(response: Response, StatusCode: number, contentType: string, Title?: string, status?: boolean, Message?: string, CookieData?: CookieType); /** * Sends a JSON response. * * @param Data - The data to be included in the response. * @param Title - The title of the response (optional). * @param Message - The message of the response (optional). * @param StatusCode - The status code of the response (optional). * @param CookieData - The cookie data to be set in the response (optional) e.g., [{ name: "cookieName", value: "cookieValue", options: { maxAge: 900000, httpOnly: true } }] */ Send(Data: any, Message?: string, Title?: string, StatusCode?: number, CookieData?: CookieType): void; /** * Sets the content type of the response. * @private */ private setContentType; }