mirror of
https://github.com/tomru/pdfer.git
synced 2026-03-03 06:27:19 +01:00
add server dir
This commit is contained in:
13
server/templates.js
Normal file
13
server/templates.js
Normal file
@@ -0,0 +1,13 @@
|
||||
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!`);
|
||||
}
|
||||
};
|
||||
Reference in New Issue
Block a user