-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(templates): fix error handling and route method call (#83)
* fix(templates): fix error handling and route method call * fix(routes): fix routes parameter calls
- Loading branch information
1 parent
492cca2
commit 5010723
Showing
6 changed files
with
37 additions
and
20 deletions.
There are no files selected for viewing
11 changes: 8 additions & 3 deletions
11
application-templates/javascript/event/src/routes/event.route.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,18 @@ | ||
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('/', (req, res, next) => { | ||
logger.info('Event message received'); | ||
res.status(200); | ||
res.send(); | ||
|
||
try { | ||
post(req, res); | ||
} catch (error) { | ||
next(error); | ||
} | ||
}); | ||
|
||
export default eventRouter; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
11 changes: 8 additions & 3 deletions
11
application-templates/javascript/service/src/routes/service.route.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,17 @@ | ||
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('/', (req, res, next) => { | ||
logger.info('Cart update extension executed'); | ||
res.status(200); | ||
res.send(); | ||
|
||
try { | ||
post(req, res); | ||
} catch (error) { | ||
next(error); | ||
} | ||
}); | ||
|
||
export default serviceRouter; |
10 changes: 7 additions & 3 deletions
10
application-templates/typescript/event/src/routes/event.route.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,17 @@ | ||
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('/', (req, res, next) => { | ||
logger.info('Event message received'); | ||
res.status(200); | ||
res.send(); | ||
try { | ||
post(req, res); | ||
} catch (error) { | ||
next(error); | ||
} | ||
}); | ||
|
||
export default eventRouter; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
15 changes: 10 additions & 5 deletions
15
application-templates/typescript/service/src/routes/service.route.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,17 @@ | ||
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('/', (req, res, next) => { | ||
logger.info('Service post message received'); | ||
|
||
try { | ||
post(req, res); | ||
} catch (error) { | ||
next(error); | ||
} | ||
}); | ||
|
||
export default serviceRouter; | ||
export default serviceRouter; |