express-ts-skeleton
Version:
This is a skeleton(boiler plate) for nodejs, express and typescript.
28 lines (27 loc) • 1.15 kB
TypeScript
import { DownloadResponse, RenderResponse } from "../interfaces/ResponseFormat";
export declare class checkResponseType {
/**
* Checks if the result is a download response.
* @param {string} result.filePath - The path of the file to download.
* @param {string} result.fileName - The name of the file to download.
* @param {number} result.statusCode - The HTTP status code.
* @returns {boolean} True if the result is a download response, false otherwise.
*/
static isDownloadResponse(result: {
filePath: string;
fileName: string;
statusCode: number;
}): result is DownloadResponse;
/**
* Checks if the result is a render response.
* @param {string} result.view - The name of the view template.
* @param {object} result.content - The content to render in the view.
* @param {number} result.statusCode - The HTTP status code.
* @returns {boolean} True if the result is a render response, false otherwise.
*/
static isRenderResponse(result: {
view: string;
content: object;
statusCode: number;
}): result is RenderResponse;
}