Book Image

Express Web Application Development

By : Hage Yaaapa
Book Image

Express Web Application Development

By: Hage Yaaapa

Overview of this book

Express is a minimal and flexible node.js web application framework, providing a robust set of features for building single and multi-page, and hybrid web applications. It provides a thin layer of features fundamental to any web application, without obscuring features that developers know and love in node.js. "Express Web Application Development" is a comprehensive guide for those looking to learn how to use the Express web framework for web application development. Starting with the initial setup of the Express web framework, "Express Web Application Development" helps you to understand the fundamentals of the framework. By the end of "Express Web Application Development", you will have acquired enough knowledge and skills to create production-ready Express apps. All of this is made possible by the incremental introduction of more advanced topics, starting from the very essentials. On the way to mastering Express for application development, we teach you the more advanced topics such as routes, views, middleware, forms, sessions, cookies and various other aspects of configuring an Express application. Jade; the recommended HTML template engine, and Stylus; the CSS pre-processor for Express, are covered in detail. Last, but definitely not least, Express Web Application Development also covers practices and setups that are required to make Express apps production-ready.
Table of Contents (15 chapters)
Express Web Application Development
About the Author
About the Reviewers

Creating an app cluster

One common argument against Node is that it is single-threaded and therefore does not perform well.

This argument is outdated and invalid—now Node comes with a module called cluster, using which we can run multiple processes of an app, essentially multiplying the performance of the app on multi-core machines, which most modern computers are.

The performance gain is more obvious when the app is processor- and memory-hungry, and is data-intensive. "Hello World" apps are likely to show little to no improvement in less stressful tests.


The cluster module is still experimental, so the API may change in the future. But the module itself is likely to be there for good.

Let's write two sample apps to find out whether the performance gain by using cluster is true or not. We will make sure these apps perform the same set of resource-intensive operations.

Here is the first app, a very basic Express app that programmatically generates a huge amount of data and sends it to the...