diff --git a/application-templates/javascript/event/src/routes/event.route.js b/application-templates/javascript/event/src/routes/event.route.js index e42f854..ea35735 100644 --- a/application-templates/javascript/event/src/routes/event.route.js +++ b/application-templates/javascript/event/src/routes/event.route.js @@ -1,13 +1,19 @@ import { Router } from 'express'; import { logger } from '../utils/logger.utils.js'; +import { post } from '../controllers/event.controller.js'; const eventRouter = Router(); -eventRouter.post('/', async (req, res) => { +eventRouter.post('/', async (req, res, next) => { logger.info('Event message received'); - res.status(200); - res.send(); + + try { + await post(req.body); + res.status(200).send(); + } catch (error) { + next(error); + } }); export default eventRouter; diff --git a/application-templates/javascript/job/src/routes/job.route.js b/application-templates/javascript/job/src/routes/job.route.js index 0bb9db2..964d990 100644 --- a/application-templates/javascript/job/src/routes/job.route.js +++ b/application-templates/javascript/job/src/routes/job.route.js @@ -8,7 +8,7 @@ const jobRouter = Router(); jobRouter.post('/', async (req, res, next) => { try { await post(req, res); - next(); + res.status(200).send(); } catch (error) { next(error); } diff --git a/application-templates/javascript/service/src/routes/service.route.js b/application-templates/javascript/service/src/routes/service.route.js index c19afcb..2609a45 100644 --- a/application-templates/javascript/service/src/routes/service.route.js +++ b/application-templates/javascript/service/src/routes/service.route.js @@ -1,12 +1,19 @@ import { Router } from 'express'; import { logger } from '../utils/logger.utils.js'; +import { post } from '../controllers/service.controller.js'; const serviceRouter = Router(); -serviceRouter.post('/', async (req, res) => { +serviceRouter.post('/', async (req, res, next) => { logger.info('Cart update extension executed'); - res.status(200); - res.send(); + + try { + // Add your custom logic here + await post(req.body); + res.status(200).send(); + } catch (error) { + next(error); + } }); export default serviceRouter; diff --git a/application-templates/typescript/event/src/routes/event.route.ts b/application-templates/typescript/event/src/routes/event.route.ts index 669f24c..22d3516 100644 --- a/application-templates/typescript/event/src/routes/event.route.ts +++ b/application-templates/typescript/event/src/routes/event.route.ts @@ -1,13 +1,18 @@ import { Router } from 'express'; import { logger } from '../utils/logger.utils'; +import { post } from '../controllers/event.controller'; const eventRouter: Router = Router(); -eventRouter.post('/', async (req, res) => { +eventRouter.post('/', async (req, res, next) => { logger.info('Event message received'); - res.status(200); - res.send(); + try { + await post(req, res); + res.status(200).send(); + } catch (error) { + next(error); + } }); export default eventRouter; diff --git a/application-templates/typescript/job/src/routes/job.route.ts b/application-templates/typescript/job/src/routes/job.route.ts index 4e201c5..3a0dbf1 100644 --- a/application-templates/typescript/job/src/routes/job.route.ts +++ b/application-templates/typescript/job/src/routes/job.route.ts @@ -8,7 +8,7 @@ const jobRouter: Router = Router(); jobRouter.post('/', async (req, res, next) => { try { await post(req, res); - next(); + res.status(200).send(); } catch (error) { next(error); } diff --git a/application-templates/typescript/service/src/routes/service.route.ts b/application-templates/typescript/service/src/routes/service.route.ts index 6f450dd..3fd93f8 100644 --- a/application-templates/typescript/service/src/routes/service.route.ts +++ b/application-templates/typescript/service/src/routes/service.route.ts @@ -1,12 +1,18 @@ import { Router } from 'express'; import { logger } from '../utils/logger.utils'; +import { post } from '../controllers/service.controller'; const serviceRouter = Router(); -serviceRouter.post('/', async (req, res) => { - logger.info('Cart update extension executed'); - res.status(200); - res.send(); +serviceRouter.post('/', async (req, res, next) => { + logger.info('Service post message received'); + + try { + await post(req, res); + res.status(200).send(); + } catch (error) { + next(error); + } }); -export default serviceRouter; +export default serviceRouter; \ No newline at end of file