Add 3 second before sending back the result to simulate some latency
authorrougeronj
Sun, 04 Jan 2015 22:41:27 +0100
changeset 356 763c925e7a9c
parent 355 fa39654e7084
child 357 70e577b0cdc6
Add 3 second before sending back the result to simulate some latency
client/data/simple-persist.js
--- a/client/data/simple-persist.js	Sun Jan 04 21:58:52 2015 +0100
+++ b/client/data/simple-persist.js	Sun Jan 04 22:41:27 2015 +0100
@@ -17,7 +17,9 @@
 
     if(req.method === "PUT" || req.method === "POST") {
       req.pipe(fs.createWriteStream(jsonFile));
-      res.end(JSON.stringify({result: "OK"}));
+      setTimeout(function () {
+    	  res.end(JSON.stringify({result: "OK"}));
+      }, 3000);
     }
     else {
       var params = require('url').parse(req.url),