A server-side platform that allows you to create high-performance networked JavaScript applications. To handle a large number of concurrent requests, node.js uses an asynchronous model to run code based on non-blocking event processing and callback handler definition. node.js is essentially similar to Ruby Event Machine and Python Twisted frameworks, but the event loop in node.js is kept hidden from the developer and resembles the event handling of a web application running in a browser, while the platform functions are not limited to web and supports creation of normal network client and server programs.

As connection multiplexing methods epoll, kqueue, /dev/poll and select are supported. Google’s V8 engine is used to provide execution of the JavaScript code. The libevent library is used for multiplexing connections, the libeio library is used to create a thread pool and c-ares is integrated to perform DNS queries in non-blocking mode. All system calls, which cause blocking, are executed inside the thread pool and then, as well as signal handlers, transfer the result of their work back through the unnamed channel (pipe).

To extend the functionality of node.js application we have prepared a large collection of modules where we find HTTP/SMTP/XMPP/DNS/FTP/IMAP/POP3 server and client implementation modules, modules for integration with various web-frameworks, WebSocket and Ajax handlers, DBMS connectors (MySQL, PostgreSQL, SQLite, MongoDB), template engine, CSS engines, cryptoalgorithms and authorization systems (like OAuth), XML parsers.

When writing node.js applications, you need to consider the specifics of event-driven programming; for example, instead of executing “var result = db.query(“select…”);” with the expectation of completion and subsequent result processing, node.js uses asynchronous execution, i.e. the code is transformed to “db.query(“select…”, function (result) {process result});” where control immediately goes to further code, and the query result is processed as data arrives. No function in node.js needs to perform I/O directly – a callback handler needs to be set up to fetch the data from disk, another process or the network.

Other server-side JavaScript systems:

  • Jaxer – allows you to bring some parts of a web application to the server side;
  • EJScript – a web framework that uses the Model View Controller (MVC) paradigm, which is reminiscent of Ruby on Rails;
  • RingoJS – another MVC framework written in Java and using Mozilla’s Rhino JavaScript engine;
  • AppengineJS – a project to enable JavaScript code execution in the Google App Engine environment.
0 Shares:
Leave a Reply

Your email address will not be published. Required fields are marked *

You May Also Like