mirror of
https://github.com/OneUptime/oneuptime.git
synced 2026-04-06 00:32:12 +02:00
Add ExpressAPIFunctionType to processIncomingRequest and returnResponse
This commit is contained in:
@@ -0,0 +1 @@
|
||||
export type PromiseVoidFunctionType = () => Promise<void>;
|
||||
7
CommonServer/Types/FunctionTypes.ts
Normal file
7
CommonServer/Types/FunctionTypes.ts
Normal file
@@ -0,0 +1,7 @@
|
||||
import { ExpressRequest, ExpressResponse, NextFunction } from "../Utils/Express";
|
||||
|
||||
export type ExpressAPIFunctionType = (
|
||||
req: ExpressRequest,
|
||||
res: ExpressResponse,
|
||||
next: NextFunction
|
||||
) => Promise<void>;
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user