scratch-www/server/render.js

17 lines
445 B
JavaScript
Raw Normal View History

2016-04-12 08:23:43 -04:00
var defaults = require('lodash.defaults');
var fs = require('fs');
var mustache = require('mustache');
var path = require('path');
var config = require('./config');
module.exports = function (route) {
// Route definition
defaults(route, config);
// Render template
var location = path.resolve(__dirname, './template.html');
var template = fs.readFileSync(location, 'utf8');
return mustache.render(template, route);
};