Spaces:
Sleeping

File size: 738 Bytes
4e83772
 
 
 
 
 
 
446bc13
4e83772
446bc13
 
4e83772
446bc13
4e83772
446bc13
4e83772
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
import { COMMON_ERRORS } from "@/constants/errors.js";
import { redisCacheService } from "@/instances.js";
import AppError from "@/utils/AppError.js";
import { STATUS_CODES } from "@/utils/statusCodes.js";
import { NextFunction, Request, Response } from "express";
export const getServerNotifications = async (req: Request, res: Response, next: NextFunction) => {
	try {
		const data = await redisCacheService.get<string>("server-notifications");
		if (!data) {
			res.status(200).json({ fromServer: null });
			return;
		}
		res.status(200).json({ fromServer: data });
	} catch (error: any) {
		console.log(error.message, error);
		next(new AppError(COMMON_ERRORS.SOMETHING_WENT_WRONG, STATUS_CODES.INTERNAL_SERVER_ERROR, error));
	}
};