refactor: refactor home and about routes
This commit is contained in:
committed by
Benedikt Rötsch
parent
1e94188333
commit
a91e46d70b
14
routes/landingPage.js
Normal file
14
routes/landingPage.js
Normal file
@@ -0,0 +1,14 @@
|
||||
const { getLandingPage } = require('../services/contentful')
|
||||
const url = require('url')
|
||||
|
||||
exports.getLandingPage = async (req, res, next) => {
|
||||
let pathname = url.parse(req.url).pathname.split('/').filter(Boolean)[0]
|
||||
pathname = pathname || 'home'
|
||||
const landingPage = await getLandingPage(
|
||||
pathname,
|
||||
res.locals.currentLocale.code,
|
||||
res.locals.currentApi.id
|
||||
)
|
||||
res.render('landingPage', { title: pathname, landingPage })
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user