tachijs
Version:
Highly testable dead simple web server written in Typescript
23 lines • 823 B
JavaScript
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const BaseResult_1 = require("./BaseResult");
class RenderResult extends BaseResult_1.BaseResult {
constructor(view, locals, callback, status = 200) {
super();
this.view = view;
this.locals = locals;
this.callback = callback;
this.status = status;
}
async execute(req, res, next) {
if (this.callback != null) {
const callback = this.callback;
return res
.status(this.status)
.render(this.view, this.locals, (error, html) => callback(error, html, req, res, next));
}
return res.status(this.status).render(this.view, this.locals);
}
}
exports.RenderResult = RenderResult;
//# sourceMappingURL=RenderResult.js.map