Add intentional latency in express

Im using express with node.js, and testing certain routes. I'm doing this tute at http://coenraets.org/blog/2012/10/creating-a-rest-api-using-node-js-express-and-mongodb/

Im calling the http://localhost:3000/wines via ajax (the content doesn't matter). But I want to test latency. Can I do something like make express respond after 2 seconds? (I want to simulate the ajax loader and I'm running on localhost so my latency is pretty much nil)

Use as middleware, for all your requests

  app.use(function(req,res,next){setTimeout(next,1000)});

Just call res.send inside of a setTimeout:

setTimeout((function() {res.send(items)}), 2000);

Try connect-pause module. It adds delay to all or only some routes in your app.