using NodeJs and setTransactionMode question


#1

Hi,
im using the dhtmlx scheduler + nodeJS + dataProcessor for the communication of the events like in this tutorial:
dhtmlx.com/blog/using-dhtmlxsch … h-node-js/

To send all Events from Server to the client i use the function
app.get(’/data’, function(req, res){
… get data from mongo…
res.send(data);
}
and the change/delete/add Events i use the function
app.post(’/data’, function(req, res){

}
Now i would like to add additional Information from which Client did send the app.get and app.post function.
Is it possible to use dp.setTransactionMode->payload for this?

I tried to setup this on client:
dp.setTransactionMode({
mode:“POST”,
payload:{
“user_name”:“testUser”
}
}, false);

On Server:
app.post(’/data’, function(req, res){
var data = req.body;
var clientUserName = data.user_name;
But data.user_name does not exist…

if its possible to send additional data how can i access them on the server side?

Would be great if someone has a advice for me :slight_smile:

Greetings Manuel


#2

Check req.params.user_name

While event’s data is sent through POST, the custom payload parameters are sent as GET part of request and are available through req.params