A comprehensive guide to developing production-ready web applications with Express.
Prototyping an application is one thing, but making sure it's ready to launch is a whole different story. This book will enable you to create maintainable, high performance, and scalable web applications that will meet your production needs. From getting started to how to develop, hone, and protect your application with Express, this book gives you all the practical information you need to feel truly confident with the advanced features of Express.
The essential bits and pieces of the framework are explained at the beginning, for a better understanding of the strong points of the framework. From there, we'll take you through the development of an application, from using middleware and template engines to RESTful APIs. By the end, you will have mastered the patterns of reusable code and error handling, and will have learned about other important aspects such as debugging, monitoring, and security.
What this book covers
Chapter 1, Diving into Express, covers the fundamentals of the framework, its use cases, how it compares to other web frameworks, and how to structure Express applications.
Chapter 2, Component Modularity Using Middleware, explains the concept of middleware in great detail while using practical examples so you will be able to create and use middleware based on the application's needs.
Chapter 3, Creating RESTful APIs, is a practical introduction to creating a RESTful API using Express. You will learn about general REST API design as well as tips and tricks provided by the framework while creating a practical application.
Chapter 4, Leveraging the Power of Template Engines, shows you how to use different template engines and techniques to organize applications as well as create a custom engine and integrate it into an existing application.
Chapter 5, Reusable Patterns for a DRY Code Base, covers how to avoid writing repeatable code in Express applications by using existing Node.js modules. Throughout this chapter, an app will be enhanced step-by-step to use such modulesuntil we get a DRY code base, where DRY stands for Don't Repeat Yourself.
Chapter 6, Error Handling, covers the various ways of dealing with error handling in an Express app, explaining how to react to errors, how to throw custom errors, and other tips and tricks.
Chapter 7, Improving the Application's Performance, covers different optimization techniques that can be used to speed up an application, both frontend and backend. You will learn how to apply these best practices into an application.
Chapter 8, Monitoring Live Applications, explains how to effectively monitor an application so that it detects anomalies and makes the user aware of them. You will learn how to integrate metrics from multiple live applications into a dashboard.
Chapter 9, Debugging, covers how to debug an application in a live production environment, or locally when things go wrong. We will be using node-inspector and exploring how to add a REPL to the application, among other things.
Chapter 10, Application Security, covers the common security countermeasures that you can take to prevent certain incidents, and also covers how to integrate them into an Express application.
Chapter 11, Testing and Improving Code Quality, covers how to write tests while creating an application as well as triggering them before committing the code along with other tools to improve code quality.
Author: Alexandru Vlăduțu