aboutsummaryrefslogblamecommitdiffhomepage
path: root/controllers/views.js
blob: 1bb4ffe703e7ec7101a81399d5c3dab349697123 (plain) (tree)
1
2
3
4
5
6
7
8
9


               
                                  
 
                                                 


                               
                                                          


                                                                                

                         












                                                                                
    
;(function () {
  'use strict'

  var express = require('express')

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

  var router = express.Router()

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

  // ---------------------------------------------------------------------------

  module.exports = router

  // ---------------------------------------------------------------------------

  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)
  }
})()