mirror of
https://github.com/fergalmoran/roboto-promoto.git
synced 2025-12-22 09:37:37 +00:00
28 lines
610 B
JavaScript
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');
|
|
};
|