Files
pdfer/server/templates.js
Thomas Ruoff db2c45342f add server dir
2017-02-23 21:00:35 +01:00

14 lines
350 B
JavaScript

const path = require('path');
module.exports.get = (templateName, options, callback) => {
const modulePath = path.join(__dirname, 'templates', templateName);
let template;
try {
template = require(modulePath);
callback(null, template(options));
} catch (e) {
callback(`${templateName} not found!`);
}
};