i am new to JavaScript and Node JS. i have the following code:
app.post('/sendSensorsUserIds', function (req, res) {
var myBody= req.body;
var sensors= myBody.Sensors;
var ids= myBody.ids;
DButils.getSensorsUserIds(connection, ids , sensors , function(ids){
return res.sendStatus(ids);
});
res.end();
});
I always get the following error:
C:\Users\Daniel\Server\node_modules\mysql\lib\protocol\Parser.js:82
throw err;
^
Error: Can't set headers after they are sent.
some one has any idea what is the problem?