Node.js's single-threaded, event-loop based programming model combined with its use of asynchronous calls for processing incoming requests makes it incredibly easy to build highly scalable, server-side applications. However, a thread can only be bound to a single-core when it is running and this means a standard Node application can at most use only one CPU on a server to process a request. Fortunately, Node's cluster API provides a flexible framework in which a Node application can launch multiple copies of the same Node script as independent operating system processes.
MVC based architecture is all the rage right in web development. There are multiple different frameworks out there that implement MVC or MV* style application architecture. But what if you simple want to leverage the cool routing that MV* apps use but don’t care about actually implementing the full MVC stack or framework? In In Listing 2, we start off with the basic object declaration. this article, we’ll create a simple router that you can use in your Node.js web apps. By the end, you’ll have a router that will allow you to implement URL routing actually needing to use a third-party framework.
Page count: 26