Questions about Blocking in NodeJs

  node.js, question
var http=require('http');
 var i=0;
 (add i add "requrest accept!"  );
 res.writeHead(200, {'Content-Type': 'text/plain'});
 res.end('Hello word');

In the above code, I use while(1); Blocking createServer callback. In my understanding, because NodeJs is single-threaded, after calling createServer to create a listen, all subsequent requests will be called back to createServer, so when I actively block in it, it will affect the next blocking request. Is this correct?

This callback function means that there are any calls to8080This callback function will be executed for all requests from the.

So, when the first request came,res.end()Normal execution, request received correct response. Since then, the callback function has not been completed.while(i)This statement blocks the only process and thread of the v8 engine and cannot execute any other code. After that, all the requests could not be processed and could not be responded to.

Your understanding is basically correct.