I have the socketController function and I wanted to call it inside the summation function so that every time I did the GET of the summation func, the socketcontroller function would be triggered. Is it possible to do this? The sum func console.log is giving UNDEFINED
controller.js
module.exports = {
async socketController(client) {
return client.send('mandando algo pro cliente');
},
async somatoria(request, response, socketController) {
console.log(socketController);
return response.json(socketController);
}
}
server.js
const interval = setInterval(() => {
socketController(client);
clearInterval(interval);
});
console.log return:
[Function: next]