2024-09-07 18:12:58 -04:00
|
|
|
function Route(deps, exec) {
|
|
|
|
this.deps = deps;
|
|
|
|
this.exec = exec;
|
|
|
|
}
|
|
|
|
|
|
|
|
Route.prototype.run = async function (req, res, input) {
|
2024-09-08 05:04:57 -04:00
|
|
|
input = input || {};
|
2024-09-07 18:12:58 -04:00
|
|
|
for (let dep of this.deps) {
|
2024-09-08 05:04:57 -04:00
|
|
|
input = {...input, ...(await dep.run(req, res, input))};
|
2024-09-07 18:12:58 -04:00
|
|
|
};
|
|
|
|
return await this.exec(req,res,input);
|
|
|
|
}
|
|
|
|
|
|
|
|
export default Route;
|