How to make node js express server handle requests in parallel
<p>Is there any way that I can make express server handle several GET requests in parallel?</p>

<p>Consider this example:</p>

<p>server.js</p>

<pre><code>var express = require('express')
var app = express();

app.get('/test01', function (req, res, next) {
    for (i = 0; i &lt; 1000000000; i++) {
        var temp = i*i;
    }
    res.end('{"success" : "test01", "status" : 200}');
});

app.get('/test02', function (req, res, next) {
    for (i = 0; i &lt; 1; i++) {
        var temp = i*i;
    }
    res.end('{"success" : "test02", "status" : 200}');
});

app.listen(8081, function () {
    console.log("server listening at  %s:%s", this.address().address, this.address().port)
})
</code></pre>

<p>client.js </p>

<pre><code>var request = require("request");

request("http://127.0.0.1:8081/test01", function(error, response, body) {
    console.log(body);
});
request("http://127.0.0.1:8081/test02", function(error, response, body) {
    console.log(body);
});
</code></pre>

<p>After running the client.js, the output is:</p>

<pre><code>{"success" : "test01", "status" : 200}
{"success" : "test02", "status" : 200}
</code></pre>

<p>which means that the second request will have to wait for the first request to be finished. </p>

<p>What do I need to change in server.js in order to make both of the requests run in parallel and making "test01" non blocking service and finishing test02 before test01?</p>

<p>I don't want to change anything in client.js and I can't control the timing of the calling of the services. e.g test01 may be call 3 times sequentially and than test02 may be called.</p>