https post
This commit is contained in:
parent
06fd87b9c9
commit
414cceacb2
@ -22,10 +22,10 @@ var server = http.createServer(function (request, response) {
|
||||
request.on('data', function (chunk) {
|
||||
body += chunk;
|
||||
});
|
||||
try {
|
||||
request.on('end', function () {
|
||||
body = JSON.parse(body);
|
||||
|
||||
request.on('end', function () {
|
||||
try {
|
||||
body = JSON.parse(body);
|
||||
var send_array = {
|
||||
"type": "data",
|
||||
"id": body.student_index,
|
||||
@ -35,8 +35,11 @@ var server = http.createServer(function (request, response) {
|
||||
};
|
||||
lookup[body.classes_code].send(JSON.stringify(send_array));
|
||||
response.end("Added");
|
||||
});
|
||||
} catch (e) {console.log(e)}
|
||||
} catch (e) {
|
||||
console.log(e);
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
else {
|
||||
response.end("Undefined request .");
|
||||
|
Loading…
Reference in New Issue
Block a user