https post

This commit is contained in:
barwie2@st.amu.edu.pl 2020-03-09 19:52:00 +01:00
parent 19e299b7cf
commit b3b4caefe7
1 changed files with 6 additions and 8 deletions

View File

@ -27,17 +27,15 @@ var server = http.createServer(function (request, response) {
});
try {
request.on('end', function () {
body = JSON.parse(body);
console.log(body);
console.log(lookup);
var body = body.split("&");
var send_array = {
"type": "data",
"id": body.student_index,
"name": body.student_name,
"surname": body.student_surname,
"classes_code": body.classes_code
"id": body[1],
"name": body[2],
"surname": body[3],
"classes_code": body[0]
};
lookup[body.classes_code].send(JSON.stringify(send_array));
lookup[body[0]].send(JSON.stringify(send_array));
});
} catch (e) {console.log(e)}
}