Add ExpressAPIFunctionType to processIncomingRequest and returnResponse

This commit is contained in:
Simon Larsen
2024-02-27 12:28:24 +00:00
parent 2a94700348
commit 45b706d7d5
4 changed files with 12 additions and 2 deletions

View File

@@ -0,0 +1 @@
export type PromiseVoidFunctionType = () => Promise<void>;

View File

@@ -0,0 +1,7 @@
import { ExpressRequest, ExpressResponse, NextFunction } from "../Utils/Express";
export type ExpressAPIFunctionType = (
req: ExpressRequest,
res: ExpressResponse,
next: NextFunction
) => Promise<void>;

View File

@@ -12,10 +12,11 @@ import { JSONObject } from 'Common/Types/JSON';
import ObjectID from 'Common/Types/ObjectID';
import IncomingMonitorRequest from 'Common/Types/Monitor/IncomingMonitor/IncomingMonitorRequest';
import OneUptimeDate from 'Common/Types/Date';
import {ExpressAPIFunctionType} from 'CommonServer/Types/FunctionTypes';
const router: ExpressRouter = Express.getRouter();
const processIncomingRequest: Function = async (
const processIncomingRequest: ExpressAPIFunctionType = async (
req: ExpressRequest,
res: ExpressResponse,
next: NextFunction

View File

@@ -10,6 +10,7 @@ import Sleep from 'Common/Types/Sleep';
import Typeof from 'Common/Types/Typeof';
import { JSONValue } from 'Common/Types/JSON';
import logger from 'CommonServer/Utils/Logger';
import {ExpressAPIFunctionType} from 'CommonServer/Types/FunctionTypes';
const router: ExpressRouter = Express.getRouter();
@@ -35,7 +36,7 @@ router.post(
}
);
const returnResponse: Function = async (
const returnResponse: ExpressAPIFunctionType = async (
req: ExpressRequest,
res: ExpressResponse,
next: NextFunction