refactor: Change views

This commit is contained in:
Khaled Garbaya
2017-09-21 14:54:43 +02:00
committed by Benedikt Rötsch
parent 3f6efdf750
commit 3373ff282d
18 changed files with 250 additions and 22 deletions

9
routes/categories.js Normal file
View File

@@ -0,0 +1,9 @@
const express = require('express')
const router = express.Router()
/* GET courses listing. */
router.get('/', function (req, res, next) {
res.render('categories', { title: 'Categories' })
})
module.exports = router

View File

@@ -6,9 +6,14 @@ router.get('/', function (req, res, next) {
res.render('courses', { title: 'Courses' })
})
/* GET courses listing. */
/* GET course detail. */
router.get('/:slug', function (req, res, next) {
res.render('courses', { title: `Course with slug ${req.params.slug}` })
})
/* GET course lesson detail. */
router.get('/:cslug/lessons/:lslug', function (req, res, next) {
res.render('courses', { title: `Course with slug ${req.params.cslug}` })
})
module.exports = router

View File

@@ -3,7 +3,7 @@ const router = express.Router()
/* GET home page. */
router.get('/', function (req, res, next) {
res.render('index', { title: 'Express' })
res.render('index', { title: 'Welcome to Contentful university' })
})
module.exports = router

View File

@@ -1,14 +0,0 @@
const express = require('express')
const router = express.Router()
/* GET lessons listing. */
router.get('/', function (req, res, next) {
res.render('lessons', { title: 'Lessons' })
})
/* GET lessons listing. */
router.get('/:slug', function (req, res, next) {
res.render('lessons', { title: `Lesson with slug ${req.params.slug}` })
})
module.exports = router

9
routes/sitemap.js Normal file
View File

@@ -0,0 +1,9 @@
const express = require('express')
const router = express.Router()
/* GET seeting page. */
router.get('/', function (req, res, next) {
res.render('sitemap', { title: 'Sitemap' })
})
module.exports = router