PeerTube/controllers/views.js

30 lines
726 B
JavaScript
Raw Normal View History

2015-11-07 11:22:05 -06:00
;(function () {
'use strict'
var express = require('express')
2016-01-31 04:23:52 -06:00
2016-02-04 14:16:27 -06:00
var cacheMiddleware = require('../middlewares').cache
2015-11-07 11:22:05 -06:00
var router = express.Router()
2016-02-04 14:16:27 -06:00
router.get(/^\/(index)?$/, cacheMiddleware.cache(), getIndex)
router.get('/partials/:directory/:name', cacheMiddleware.cache(), getPartial)
2016-01-31 04:23:52 -06:00
// ---------------------------------------------------------------------------
2015-11-07 11:22:05 -06:00
module.exports = router
2016-01-31 04:23:52 -06:00
// ---------------------------------------------------------------------------
function getIndex (req, res) {
res.render('index')
}
function getPartial (req, res) {
var directory = req.params.directory
var name = req.params.name
res.render('partials/' + directory + '/' + name)
}
2015-11-07 11:22:05 -06:00
})()