In a code for a GroupMe chat bot, the variable request
is defined as follows:
var request = JSON.parse(this.req.chunks[0]);
I'm trying to figure out what this means. In particlar, what is req
referring to?
EDIT: Here is the function where it shows up:
function respond() {
var request = JSON.parse(this.req.chunks[0]),
botRegex = /^deadline ([0-9]|0[0-9]|1[0-9]|2[0-3]):[0-5][0-9]$/;
botRegex2 = /^\/oranges$/;
if(request.text && botRegex.test(request.text)) {
this.res.writeHead(200);
postDeadline();
this.res.end();
} else if (request.text && botRegex2.test(request.text)) {
this.res.writeHead(200);
postOranges();
this.res.end();
} else {
console.log("don't care");
this.res.writeHead(200);
this.res.end();
}
}