2023-05-02 14:29:22 +00:00
|
|
|
import Express, {
|
|
|
|
ExpressRequest,
|
|
|
|
ExpressResponse,
|
|
|
|
ExpressRouter,
|
|
|
|
NextFunction,
|
|
|
|
} from 'CommonServer/Utils/Express';
|
|
|
|
import Response from 'CommonServer/Utils/Response';
|
2023-05-05 11:55:51 +00:00
|
|
|
import ProbeAuthorization from '../Middleware/ProbeAuthorization';
|
2023-05-02 14:29:22 +00:00
|
|
|
|
|
|
|
const router: ExpressRouter = Express.getRouter();
|
|
|
|
|
|
|
|
router.post(
|
|
|
|
'/alive',
|
2023-05-05 11:55:51 +00:00
|
|
|
ProbeAuthorization.isAuthorizedServiceMiddleware,
|
2023-05-02 14:29:22 +00:00
|
|
|
async (
|
|
|
|
req: ExpressRequest,
|
|
|
|
res: ExpressResponse,
|
|
|
|
next: NextFunction
|
|
|
|
): Promise<void> => {
|
|
|
|
try {
|
2023-05-05 12:02:23 +00:00
|
|
|
// middleware marks the probe as alive.
|
2023-07-30 15:10:45 +00:00
|
|
|
// so we don't need to do anything here.
|
2023-05-02 14:29:22 +00:00
|
|
|
return Response.sendEmptyResponse(req, res);
|
|
|
|
} catch (err) {
|
|
|
|
return next(err);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
);
|
|
|
|
|
|
|
|
export default router;
|