Skip to content

Commit efbcc00

Browse files
Update to Express.js v5
1 parent 170a5ec commit efbcc00

File tree

5 files changed

+777
-306
lines changed

5 files changed

+777
-306
lines changed

app/lib/utils/dynamic-routing.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,8 @@ const createDynamicTemplateRoute = (options) => {
1111
const { templatePrefix } = options
1212

1313
return (req, res, next) => {
14-
const subPath = req.params[0] // Get the wildcard path
14+
const { subPaths } = req.params // Get the wildcard paths
15+
const subPath = subPaths?.join('/') ?? ''
1516

1617
console.log(`Dynamic route attempting to render: ${templatePrefix}/${subPath}`)
1718

app/routes/events.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -892,7 +892,7 @@ module.exports = router => {
892892

893893
// General purpose dynamic template route for events
894894
// This should come after any more specific routes
895-
router.get('/clinics/:clinicId/events/:eventId/*',
895+
router.get('/clinics/:clinicId/events/:eventId/*subPaths',
896896
createDynamicTemplateRoute({
897897
templatePrefix: 'events'
898898
})

app/routes/participants.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ module.exports = router => {
113113
res.render('participants/show')
114114
})
115115

116-
router.get('/participants/:participantId/*', createDynamicTemplateRoute({
116+
router.get('/participants/:participantId/*subPaths', createDynamicTemplateRoute({
117117
templatePrefix: 'participants'
118118
}))
119119

0 commit comments

Comments
 (0)