refactor: refactor routes

This commit is contained in:
Khaled Garbaya
2017-10-23 14:40:20 +02:00
committed by Benedikt Rötsch
parent 8640483af3
commit 1e94188333
7 changed files with 61 additions and 70 deletions

View File

@@ -1,12 +1,10 @@
const express = require('express')
const { getLandingPage } = require('../services/contentful')
const { catchErrors } = require('../handlers/errorHandlers')
const router = express.Router()
/* GET the about page. */
router.get('/', catchErrors(async function (req, res, next) {
const landingPage = await getLandingPage('about', res.locals.currentLocale.code, res.locals.currentApi.id)
exports.getAbout = async (req, res, next) => {
const landingPage = await getLandingPage('about',
res.locals.currentLocale.code,
res.locals.currentApi.id
)
res.render('landingPage', { title: 'About', landingPage })
}))
}
module.exports = router