transform about into a landing page and generalize code (#12)
This commit is contained in:
@@ -1,9 +1,12 @@
|
||||
const express = require('express')
|
||||
const { getLandingPage } = require('../services/contentful')
|
||||
const { catchErrors } = require('../handlers/errorHandlers')
|
||||
const router = express.Router()
|
||||
|
||||
/* GET about page. */
|
||||
router.get('/', function (req, res, next) {
|
||||
res.render('about', { title: 'About' })
|
||||
})
|
||||
/* GET the about landing page. */
|
||||
router.get('/', catchErrors(async function (req, res, next) {
|
||||
const landingPage = await getLandingPage('about', req.query.locale, req.query.api)
|
||||
res.render('landingPage', { title: 'About', landingPage })
|
||||
}))
|
||||
|
||||
module.exports = router
|
||||
|
||||
Reference in New Issue
Block a user