diff --git a/src/Controllers/CalculatorController.ts b/src/Controllers/CalculatorController.ts index 7175826cf86ee87374cd94a498cd5eb4137613c3..a82f3b65d534b0297827e45ac77782a704904250 100644 --- a/src/Controllers/CalculatorController.ts +++ b/src/Controllers/CalculatorController.ts @@ -7,17 +7,17 @@ import CalculatorResponse from '../DTOs/CalculatorResponseDTO'; const router = Router(); -const parseSheet: Handler = async (req: Request, res: Response) => { +const getREP: Handler = async (req: Request, res: Response) => { const groups: AgeGroup[] = req.body; try { - const energyRequirement: CalculatorResponse = CalculatorService.calculateREP(groups); - return res.status(200).send(energyRequirement); + const EnergyReq: CalculatorResponse = CalculatorService.calculateEnergeticRequirement(groups); + return res.status(200).send(EnergyReq); } catch (error) { const e = error as Error; return res.status(400).json({ error: e.message }); } }; -router.post('/', parseSheet); +router.post('/', getREP); export default router; diff --git a/src/routes.ts b/src/routes.ts index ed8df5918a887121d647a539d424ec5e25525a09..1e83e85760de22ae93662adef9e5b7ae4c998e7f 100644 --- a/src/routes.ts +++ b/src/routes.ts @@ -1,12 +1,15 @@ -import { Request, Response, Router } from 'express'; -import SheetController from './Controllers/SheetController'; - -const router = Router(); - -router.get('/', (req: Request, res: Response): void => { - res.send('Hey! This is REPP API, you can go to /api-docs to learn more!'); -}); - -router.use('/sheetParser', SheetController); - -export default router; +import { Request, Response, Router } from 'express'; +import SheetController from './Controllers/SheetController'; +import CalculatorController from './Controllers/CalculatorController'; + +const router = Router(); + +router.get('/', (req: Request, res: Response): void => { + res.send('Hey! This is REPP API, you can go to /api-docs to learn more!'); +}); + +router.use('/sheetParser', SheetController); + +router.use('/REPcalculator', CalculatorController); + +export default router;