Introducing Node.js
Node.js is gaining a lot of popularity during the last years and more and more developers embrace Node.js. But what is it and why should we use it?
What is Node.js?
Node.js is a runtime system for creating server applications. The core of Node.js is a bare, stripped server that accepts requests and can respond to them. All this occurs in a so called loop. There is no underlying web server like Internet Information Server or Apache needed to run Node.js. Every request to a Node.js application spins off a new thread on the server. This means that the main thread in Node.js never gets blocked and that potentially it can serve thousands and thousands of concurrent users. On http://nodejs.org, you can find lots of information and examples of Node.js.
The most basic example of a Node.js application is shown here:
var http = require('http'); http.createServer(function (req, res) { res.writeHead(200, {'Content-Type': 'text/plain'}); res.end('Hello World\n'); }).listen(1337,...