Spaces:
Sleeping
Sleeping
Download backend/src/modules/about/about.controller.ts from moustafa7/protofolio: direct link, hf CLI and curl.
- Browser
- Download file 920 Bytes
-
https://huggingface.co/spaces/moustafa7/protofolio/resolve/main/backend/src/modules/about/about.controller.ts
- Command line
-
hf download hf://spaces/moustafa7/protofolio/backend/src/modules/about/about.controller.ts
-
curl -L -o about.controller.ts https://huggingface.co/spaces/moustafa7/protofolio/resolve/main/backend/src/modules/about/about.controller.ts
920 Bytes
| import { Response } from "express"; | |
| import { AboutService } from "./about.service"; | |
| import { ApiResponse } from "../../utils/apiResponse"; | |
| import { AuthRequest } from "../../types"; | |
| const aboutService = new AboutService(); | |
| export class AboutController { | |
| async get(req: AuthRequest, res: Response) { | |
| const about = await aboutService.get(); | |
| return ApiResponse.success(res, about); | |
| } | |
| async create(req: AuthRequest, res: Response) { | |
| const about = await aboutService.create(req.body); | |
| return ApiResponse.success(res, about, "About created", 201); | |
| } | |
| async update(req: AuthRequest, res: Response) { | |
| const about = await aboutService.update(req.params.id, req.body); | |
| return ApiResponse.success(res, about, "About updated"); | |
| } | |
| async delete(req: AuthRequest, res: Response) { | |
| await aboutService.delete(req.params.id); | |
| return ApiResponse.success(res, null, "About deleted"); | |
| } | |
| } | |