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