Files
roboto-promoto/lib/controllers/index.js
2014-03-31 09:28:33 +01:00

28 lines
610 B
JavaScript

'use strict';
var path = require('path');
/**
* Send partial, or 404 if it doesn't exist
*/
exports.partials = function (req, res) {
var stripped = req.url.split('.')[0];
var requestedView = path.join('./', stripped);
res.render(requestedView, function (err, html) {
if (err) {
console.log("Error rendering partial '" + requestedView + "'\n", err);
res.status(404);
res.send(404);
} else {
res.send(html);
}
});
};
/**
* Send our single page app
*/
exports.index = function (req, res) {
res.render('index');
};