Node js runs on top of V8 Google Chrome's Javascript engine
Posted: Thu Feb 20, 2025 9:16 am
Which is known for its speed. The good news is that Mozilla Software Foundation is already implementing Node.js on top of its own Javascript engine, SpiderMonkey, which will generate competition and we will surely see the performance of these engines improve even more in the coming months.
For now, one of the most common uses of Node.js is to create web applications that run in real time using web sockets or comet (long polling). Other common applications of node.js are server monitoring and scripting to reduce (minify) CSS and Javascript.
Hello world
The typical Node.js “hello world” is to program a web server. Listing 1 shows Qatar Mobile Database the code for this:
The first thing the code does is load the http module and save it in a variable. Then we create a server with the “createServer” function, which takes as a parameter a callback function that receives as parameters a request and a response (req, res). In this case, the response consists of printing a plain text web page that says “Hello World”. Once we define what our function is going to do, we start listening for requests on a specific port (in this case we chose 1337) and we print a warning message.
To generate a Comet-like web server, all we have to do is delay the response until we have the information we want to send. Listing 2 shows how to do this.
For now, one of the most common uses of Node.js is to create web applications that run in real time using web sockets or comet (long polling). Other common applications of node.js are server monitoring and scripting to reduce (minify) CSS and Javascript.
Hello world
The typical Node.js “hello world” is to program a web server. Listing 1 shows Qatar Mobile Database the code for this:
The first thing the code does is load the http module and save it in a variable. Then we create a server with the “createServer” function, which takes as a parameter a callback function that receives as parameters a request and a response (req, res). In this case, the response consists of printing a plain text web page that says “Hello World”. Once we define what our function is going to do, we start listening for requests on a specific port (in this case we chose 1337) and we print a warning message.
To generate a Comet-like web server, all we have to do is delay the response until we have the information we want to send. Listing 2 shows how to do this.