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

10 lines
463 B
JavaScript

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