refactor: refactor routes
This commit is contained in:
committed by
Benedikt Rötsch
parent
8640483af3
commit
1e94188333
@@ -1,6 +1,11 @@
|
||||
const express = require('express')
|
||||
const { getLandingPage } = require('../services/contentful')
|
||||
const { catchErrors } = require('../handlers/errorHandlers')
|
||||
const { getCourses, getCourse, getLesson, getCourseByCategory } = require('./courses')
|
||||
const { getSettings, postSettings } = require('./settings')
|
||||
const { getCategories } = require('./categories')
|
||||
const { getSitemap } = require('./sitemap')
|
||||
const { getAbout } = require('./about')
|
||||
const router = express.Router()
|
||||
|
||||
/* GET the home landing page. */
|
||||
@@ -16,4 +21,24 @@ router.get('/', catchErrors(async function (req, res, next) {
|
||||
})
|
||||
}))
|
||||
|
||||
/* Courses Routes */
|
||||
router.get('/courses', catchErrors(getCourses))
|
||||
router.get('/courses/categories/:category', catchErrors(getCourseByCategory))
|
||||
router.get('/courses/:slug', catchErrors(getCourse))
|
||||
router.get('/courses/:slug/lessons', catchErrors(getCourse))
|
||||
router.get('/courses/:cslug/lessons/:lslug', catchErrors(getLesson))
|
||||
|
||||
/* Settings Routes */
|
||||
router.get('/settings', catchErrors(getSettings))
|
||||
router.post('/settings', catchErrors(postSettings))
|
||||
|
||||
/* Categories Route */
|
||||
router.get('/categories', catchErrors(getCategories))
|
||||
|
||||
/* Sitemap Route */
|
||||
router.get('/sitemap', catchErrors(getSitemap))
|
||||
|
||||
/* About Route */
|
||||
router.get('/about', catchErrors(getAbout))
|
||||
|
||||
module.exports = router
|
||||
|
||||
Reference in New Issue
Block a user