Archived
backend: Ajouts de fonctions à exécuter pour /functions/:functionName
This commit is contained in:
1 parent
f631873893
commit
fd3224ee42
9 files changed
+184
-25
No files matched your search
@@ -2,9 +2,9 @@ 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);
|
||||
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 });
|
||||
}
|
||||
Reference in new issue
Block a user