https post

This commit is contained in:
barwie2@st.amu.edu.pl 2020-03-09 19:58:58 +01:00
parent 02f9bc14a6
commit 92361347d3

View File

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