diff options
author | Chocobozzz <florian.bigard@gmail.com> | 2015-06-09 17:41:40 +0200 |
---|---|---|
committer | Chocobozzz <florian.bigard@gmail.com> | 2015-10-29 23:14:54 +0100 |
commit | 8c308c2bf7f658945d80be9d5880361238635f5b (patch) | |
tree | 2130ae60af58e59dab3df07a5d5cdd5174f91ae8 /routes/index.js | |
parent | 8cb4b4e00ee57eb98dfe1455b6d2de36fc561797 (diff) | |
download | PeerTube-8c308c2bf7f658945d80be9d5880361238635f5b.tar.gz PeerTube-8c308c2bf7f658945d80be9d5880361238635f5b.tar.zst PeerTube-8c308c2bf7f658945d80be9d5880361238635f5b.zip |
Spawn
Diffstat (limited to 'routes/index.js')
-rw-r--r-- | routes/index.js | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/routes/index.js b/routes/index.js new file mode 100644 index 000000000..690913a84 --- /dev/null +++ b/routes/index.js | |||
@@ -0,0 +1,24 @@ | |||
1 | ;(function () { | ||
2 | 'use strict' | ||
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') | ||
16 | var middleware = require('../middlewares') | ||
17 | |||
18 | var router = express.Router() | ||
19 | |||
20 | router.get('/partials/:directory/:name', middleware.cache(), getPartial) | ||
21 | router.get(/^\/(index)?$/, middleware.cache(), getIndex) | ||
22 | |||
23 | module.exports = router | ||
24 | })() | ||