aboutsummaryrefslogtreecommitdiffhomepage
path: root/routes/views.js
blob: 690913a840295c932df2e202c4b5568141ee861d (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
;(function () {
  'use strict'

  function getPartial (req, res) {
    var directory = req.params.directory
    var name = req.params.name

    res.render('partials/' + directory + '/' + name)
  }

  function getIndex (req, res) {
    res.render('index')
  }

  var express = require('express')
  var middleware = require('../middlewares')

  var router = express.Router()

  router.get('/partials/:directory/:name', middleware.cache(), getPartial)
  router.get(/^\/(index)?$/, middleware.cache(), getIndex)

  module.exports = router
})()