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
448 B
JavaScript

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