我需要在不使用framworks的情况下对车把进行压力测试,但是我不能包括SPA的“页眉和页脚”外部模型。
const fs = require('fs');
const { compile } = require('handlebars');
const template = fs.readFileSync(__dirname + '/views/index.handlebars', 'utf8');
module.exports = class Handlebars {
constructor(config) {
this.config = config;
};
get(data) {
return new Promise((resolve, reject) => {
try {
const compiled = compile(template);
resolve(compiled(data));
} catch (exception) {
reject(exception);
}
});
};
};