aboutsummaryrefslogtreecommitdiffhomepage
path: root/controllers/views.js
diff options
context:
space:
mode:
Diffstat (limited to 'controllers/views.js')
-rw-r--r--controllers/views.js29
1 files changed, 17 insertions, 12 deletions
diff --git a/controllers/views.js b/controllers/views.js
index ebd97380e..1bb4ffe70 100644
--- a/controllers/views.js
+++ b/controllers/views.js
@@ -1,24 +1,29 @@
1;(function () { 1;(function () {
2 'use strict' 2 'use strict'
3 3
4 function getPartial (req, res) {
5 var directory = req.params.directory
6 var name = req.params.name
7
8 res.render('partials/' + directory + '/' + name)
9 }
10
11 function getIndex (req, res) {
12 res.render('index')
13 }
14
15 var express = require('express') 4 var express = require('express')
5
16 var middleware = require('../middlewares').misc 6 var middleware = require('../middlewares').misc
17 7
18 var router = express.Router() 8 var router = express.Router()
19 9
20 router.get('/partials/:directory/:name', middleware.cache(), getPartial)
21 router.get(/^\/(index)?$/, middleware.cache(), getIndex) 10 router.get(/^\/(index)?$/, middleware.cache(), getIndex)
11 router.get('/partials/:directory/:name', middleware.cache(), getPartial)
12
13 // ---------------------------------------------------------------------------
22 14
23 module.exports = router 15 module.exports = router
16
17 // ---------------------------------------------------------------------------
18
19 function getIndex (req, res) {
20 res.render('index')
21 }
22
23 function getPartial (req, res) {
24 var directory = req.params.directory
25 var name = req.params.name
26
27 res.render('partials/' + directory + '/' + name)
28 }
24})() 29})()