UNPKG

604 BTypeScriptView Raw
1import { Request as ERequest, Response as EResponse } from "express";
2/**
3 *
4 * This class simply wrap the original Response class in order to add async/await
5 * functionality, improving code readability and maintenability.
6 */
7export default abstract class AsyncResponse {
8 /**
9 * Generate the correct response, injecting it to the standard Express response.
10 * @param req the standard Express request
11 * @param res the standard Express response
12 */
13 abstract asyncResponse(req: ERequest, res: EResponse): Promise<void>;
14 performResponse(req: ERequest, res: EResponse): void;
15}