I'm using Express over Node.js and I'm currently writing loading views for my app (a screen that will show up when data is being fetched) but when I'm testing in local there are, obviously, no delays from the server and I can't see if the screens are working.
Is it possible to introduce a delay in Node.js for all responses without having to add a setTimeout for each response?
I tried slow-proxy, but it fails to load the absolute paths in the HTML (e.g. /img/item.png is mapped as such instead of /proxy/2000/img/item.png).
In express/connect just put this above other middleware:
app.use(function(req,res,next){
setTimeout(next, 2000)
});
And a coffeescript version:
app.use (res,req,next)-> setTimeout(next,2000)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With