Download src/controllers/serverDataOnlyController.ts from lynfera/api: direct link, hf CLI and curl.
- Browser
- Download file 738 Bytes
-
https://huggingface.co/spaces/lynfera/api/resolve/main/src/controllers/serverDataOnlyController.ts
- Command line
-
hf download hf://spaces/lynfera/api/src/controllers/serverDataOnlyController.ts
-
curl -L -o serverDataOnlyController.ts https://huggingface.co/spaces/lynfera/api/resolve/main/src/controllers/serverDataOnlyController.ts
738 Bytes
| 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)); | |
| } | |
| }; | |