Skip to content
This repository was archived by the owner on May 24, 2020. It is now read-only.

Commit 794ca02

Browse files
try to work with json
1 parent 0ee64e6 commit 794ca02

File tree

1 file changed

+23
-23
lines changed

1 file changed

+23
-23
lines changed

app.js

Lines changed: 23 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -34,33 +34,33 @@ app.post('/update', (req, res) => {
3434
let total = req.body.total;
3535
let first_connected = req.body.first_connected;
3636

37-
// if (Number.isInteger(touches) &&
38-
// Number.isInteger(vibrs) &&
39-
// Number.isInteger(total) &&
40-
// typeof(first_connected) == 'boolean') {
37+
if (Number.isInteger(touches) &&
38+
Number.isInteger(vibrs) &&
39+
Number.isInteger(total) &&
40+
typeof(first_connected) == 'boolean') {
4141

42-
// data.touches = touches;
43-
// data.vibrs = vibrs;
44-
// data.total = total;
42+
data.touches = touches;
43+
data.vibrs = vibrs;
44+
data.total = total;
4545

46-
// if (first_connected) {
46+
if (first_connected) {
4747
io.emit('first_connected', data);
48-
// }
49-
// else {
50-
// io.emit('update', data);
51-
// }
48+
}
49+
else {
50+
io.emit('update', data);
51+
}
5252

53-
// res.json({
54-
// status : 'okay',
55-
// time : new Date(),
56-
// });
57-
// }
58-
// else {
59-
// res.json({
60-
// status : 'failed',
61-
// error : 'some variables are undefined or incorrect'
62-
// });
63-
// }
53+
res.json({
54+
status : 'okay',
55+
time : new Date(),
56+
});
57+
}
58+
else {
59+
res.json({
60+
status : 'failed',
61+
error : 'some variables are undefined or incorrect'
62+
});
63+
}
6464
});
6565

6666
server.listen(process.env.PORT || 5000);

0 commit comments

Comments
 (0)