|
@@ -30,15 +30,15 @@ server = http.createServer(function(req, res){
|
|
|
});
|
|
|
req.on('end', function () {
|
|
|
console.log("Body: " + body);
|
|
|
-
|
|
|
+ try{
|
|
|
data = JSON.parse(body);
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
+ }
|
|
|
+ catch (e){
|
|
|
+ console.log("wrong JSON");
|
|
|
+ var errorCode = -4;
|
|
|
+ res.end(JSON.stringify({errorCode: errorCode, errorMessage: errorMessages[errorCode]}));
|
|
|
+ return;
|
|
|
+ }
|
|
|
var timestamp =(new Date()).getTime();
|
|
|
|
|
|
|