14 lines
No EOL
330 B
JavaScript
14 lines
No EOL
330 B
JavaScript
function Route(deps, exec) {
|
|
this.deps = deps;
|
|
this.exec = exec;
|
|
}
|
|
|
|
Route.prototype.run = async function (req, res, input) {
|
|
input = input || {};
|
|
for (let dep of this.deps) {
|
|
input = {...input, ...(await dep.run(req, res, input))};
|
|
};
|
|
return await this.exec(req,res,input);
|
|
}
|
|
|
|
export default Route; |