https post

This commit is contained in:
barwie2@st.amu.edu.pl 2020-03-09 19:43:37 +01:00
parent 79280743d8
commit 19e299b7cf
2 changed files with 16 additions and 16 deletions

View File

@ -9,7 +9,6 @@ console.log("Websocket server running on port " + websocket_port);
var lookup = []; var lookup = [];
wss.on('connection', function connection(ws) { wss.on('connection', function connection(ws) {
console.log(ws);
lookup[ws.protocol] = ws; lookup[ws.protocol] = ws;
}); });
/*{ /*{
@ -26,7 +25,7 @@ var server = http.createServer(function (request, response) {
request.on('data', function (chunk) { request.on('data', function (chunk) {
body += chunk; body += chunk;
}); });
try {
request.on('end', function () { request.on('end', function () {
body = JSON.parse(body); body = JSON.parse(body);
console.log(body); console.log(body);
@ -40,6 +39,7 @@ 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));
}); });
} catch (e) {console.log(e)}
} }
else { else {
response.end("Undefined request ."); response.end("Undefined request .");

View File

@ -297,7 +297,7 @@ function printStudent(item) {
}); });
axios.post('http://150.254.78.197:8889', JSON.stringify({ axios.post('https://atcheck.projektstudencki.pl/students', JSON.stringify({
classes_code: class_code, classes_code: class_code,
student_index: item[2], student_index: item[2],
student_name: item[0], student_name: item[0],