I wrote a basic web server
If the first user open 127.0.0.1/complex
and the second user open 127.0.0.1/simple
2nd user cannot see website until 1st user complete
How can I solve this problem?
var http = require('http');
var url = require('url');
http.createServer(function (req, res) {
var pathname = url.parse(req.url).pathname;
res.writeHead(200, {'Content-Type': 'text/plain'});
if(pathname=='/complex')
{
console.log('complex');
complexFunction(res);
}
else if(pathname=='/simple')
{
console.log('simple');
simpleFunction(res);
}
}).listen(80, '127.0.0.1');
function complexFunction(res)
{
for(var i=0; i<9999999999; i++)
{
var complex=200000/3;
complex*=200;
}
res.end('complex');
}
function simpleFunction(res)
{
var simple=1;
res.end('simple');
}