diff options
Diffstat (limited to 'server/controllers/views.js')
-rw-r--r-- | server/controllers/views.js | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/server/controllers/views.js b/server/controllers/views.js new file mode 100644 index 000000000..aa9718079 --- /dev/null +++ b/server/controllers/views.js | |||
@@ -0,0 +1,27 @@ | |||
1 | 'use strict' | ||
2 | |||
3 | var express = require('express') | ||
4 | |||
5 | var cacheMiddleware = require('../middlewares').cache | ||
6 | |||
7 | var router = express.Router() | ||
8 | |||
9 | router.get(/^\/(index)?$/, cacheMiddleware.cache(), getIndex) | ||
10 | router.get('/partials/:directory/:name', cacheMiddleware.cache(), getPartial) | ||
11 | |||
12 | // --------------------------------------------------------------------------- | ||
13 | |||
14 | module.exports = router | ||
15 | |||
16 | // --------------------------------------------------------------------------- | ||
17 | |||
18 | function getIndex (req, res) { | ||
19 | res.render('index') | ||
20 | } | ||
21 | |||
22 | function getPartial (req, res) { | ||
23 | var directory = req.params.directory | ||
24 | var name = req.params.name | ||
25 | |||
26 | res.render('partials/' + directory + '/' + name) | ||
27 | } | ||