I created a server which listen to port 8888:
http.createServer(function (req, res) {
res.writeHead(200, {'Content-Type': 'text/html'});
console.log('start server');
req.on('data', function (data) {
var
json = null,
url_parts = {};
url_parts = url.parse(req.url);
json = JSON.parse(data);
if (Router.route(url_parts, json, res) === false) {
console.log('error with routing');
res.end('error with routing');
return;
}
console.log('end of request');
res.end('success');
});
}).listen(8888);
In Router.route, there's an heavy code executing.
The problem is-when someone access the url http://localhost:8888/SOME_URLanother calling to this port like: http://localhost:8888/SOME_OTHER_URL he has to wait a lot of time..
How can I handle both calls simultaneously?
Tnx for your help!