https post

This commit is contained in:
barwie2@st.amu.edu.pl 2020-03-09 22:58:57 +01:00
parent 414cceacb2
commit 6ab5679bde

View File

@ -24,7 +24,6 @@ var server = http.createServer(function (request, response) {
}); });
request.on('end', function () { request.on('end', function () {
try {
body = JSON.parse(body); body = JSON.parse(body);
var send_array = { var send_array = {
"type": "data", "type": "data",
@ -35,9 +34,6 @@ var server = http.createServer(function (request, response) {
}; };
lookup[body.classes_code].send(JSON.stringify(send_array)); lookup[body.classes_code].send(JSON.stringify(send_array));
response.end("Added"); response.end("Added");
} catch (e) {
console.log(e);
}
}); });
} }
@ -46,6 +42,10 @@ var server = http.createServer(function (request, response) {
} }
}); });
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);