This repository has been archived on 2024-10-29. You can view files and clone it, but cannot push or open issues or pull requests.
FunctionProject/backend/controllers/functions.js
2020-03-19 22:59:06 +01:00

10 lines
461 B
JavaScript

const errorHandling = require('../assets/utils/errorHandling');
const functionToExecute = require('../assets/functions/functionObject');
exports.executeFunctionName = (req, res, next) => {
const functionOutput = functionToExecute(req.params.functionName);
if (functionOutput !== undefined) {
return functionOutput({ res, next }, req.body);
}
return errorHandling(next, { message: "La fonction n'existe pas.", statusCode: 404 });
}