1 | 'use strict';
|
2 |
|
3 | var ejs = require('ejs');
|
4 | var path = require('path');
|
5 | var fs = require('fs');
|
6 |
|
7 | module.exports = function () {};
|
8 | module.exports.pitch = function (remainingRequest, precedingRequest, data) {
|
9 | this.cacheable && this.cacheable();
|
10 |
|
11 | var callback = this.async();
|
12 | var params = JSON.parse(this.query.slice(1));
|
13 | var templatePath = path.join(__dirname, '../../tpls/runtime-template.js');
|
14 |
|
15 | this.addDependency(templatePath);
|
16 |
|
17 | fs.readFile(templatePath, 'utf-8', function (err, template) {
|
18 | if (err) return callback(err);
|
19 |
|
20 | template = ejs.render(template, params);
|
21 | callback(null, template);
|
22 | });
|
23 | }; |
\ | No newline at end of file |