https post
This commit is contained in:
parent
6ab5679bde
commit
391ed435b9
@ -24,28 +24,28 @@ var server = http.createServer(function (request, response) {
|
|||||||
});
|
});
|
||||||
|
|
||||||
request.on('end', function () {
|
request.on('end', function () {
|
||||||
body = JSON.parse(body);
|
try {
|
||||||
var send_array = {
|
body = JSON.parse(body);
|
||||||
"type": "data",
|
var send_array = {
|
||||||
"id": body.student_index,
|
"type": "data",
|
||||||
"name": body.student_name,
|
"id": body.student_index,
|
||||||
"surname": body.student_surname,
|
"name": body.student_name,
|
||||||
"classes_code": body.classes_code
|
"surname": body.student_surname,
|
||||||
};
|
"classes_code": body.classes_code
|
||||||
lookup[body.classes_code].send(JSON.stringify(send_array));
|
};
|
||||||
response.end("Added");
|
lookup[body.classes_code].send(JSON.stringify(send_array));
|
||||||
|
response.end("Added");
|
||||||
|
} catch (e) {
|
||||||
|
console.log(e);
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
response.end("Undefined request.");
|
response.end("Undefined request .");
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
server.on('error', function (e) {
|
|
||||||
console.log(e);
|
|
||||||
});
|
|
||||||
|
|
||||||
var http_port = 8889;
|
var http_port = 8889;
|
||||||
server.listen(http_port);
|
server.listen(http_port);
|
||||||
console.log("HTTP server running on port " + http_port);
|
console.log("HTTP server running on port " + http_port);
|
||||||
|
Loading…
Reference in New Issue
Block a user