Delaying Proxy in NodeJS

2015/01/08

It is about time to add a new tool to your toolbox.

During the Christmas holiday season I had some time to learn NodeJS. In this post I’ll show how to create a simple (but useful!) proxy server in less than 30 lines of code. I’ll also give some hints on how to start with JavaScript with no prior experience.

Delaying Proxy

To give some background. I have a piece of code calling elasticsearch via its REST api and I wanted to test how it behaves in case of various network delays. I decide to create a simple proxy to simulate it. The idea is depicted below.

Proxy to simulate network delays

The requirements for the delaying are: #

An example usage may look like this. #