Free Sample
+ Collection

Mastering Web Application Development with Express

Alexandru Vlăduțu

A comprehensive guide to developing production-ready web applications with Express
RRP $29.99
RRP $49.99
Print + eBook

Want this title & more?

$12.99 p/month

Subscribe to PacktLib

Enjoy full and instant access to over 2000 books and videos – you’ll find everything you need to stay ahead of the curve and make sure you can always get the job done.

Book Details

ISBN 139781783981083
Paperback358 pages

About This Book

  • Create fast, secure and reliable production-ready web applications using Express
  • Packed with the latest techniques for tackling real world issues
  • Improve code quality and speed up development by using a variety of patterns and tools
  • You can download the updated code file from here

Who This Book Is For

If you are a Node.js developer who wants to take your Express skills to the next level and develop high performing, reliable web applications using best practices, this book is ideal for you. The only prerequisite is knowledge of Node.js.

Table of Contents

Chapter 1: Diving into Express
The best parts of Express
Comparing Express with other frameworks
Use cases
Express into the wild
The application structure
Chapter 2: Component Modularity Using Middleware
Connecting middleware
The functionality of middleware
Creating configurable middleware
Environment-based loading of middleware
Express routes
Ordering of middleware
Handling errors with middleware
Mounting subapplications
Replicating the middleware system
Chapter 3: Creating RESTful APIs
An overview of REST
SmartNotes application requirements
Creating RESTful URLs of the application
Implementing the SmartNotes application
API versioning
API rate limiting
Facilitating caching
Content negotiation
Chapter 4: Leveraging the Power of Template Engines
The different types of template engines
View helpers and application-level data
Sharing code between templates with partial views
DRY templates with layouts
Template engine consolidation with consolidate.js
View caching in production
Integrating a template engine with Express
Choosing a template engine
Chapter 5: Reusable Patterns for a DRY Code Base
Creating the MovieApp sample application
Error checks and callback functions
Tiny modules for better control flow
Ensuring a single callback execution
Extending objects in a reusable way
A simple way to create custom errors
Chapter 6: Error Handling
Runtime (operational) errors and human errors
Ways of delivering errors in the Node applications
Strings instead of errors as an antipattern
Improving stack traces
Handling uncaught exceptions
Logging errors
Creating a custom Express error handler
Richer errors with VError
Error handling in a practical application
Chapter 7: Improving the Application's Performance
Serving static resources with Express
Backend improvements
Chapter 8: Monitoring Live Applications
Simple tips for improving the application monitoring
Collecting metrics
Useful existing monitoring tools
Ensuring the application uptime
Chapter 9: Debugging
A better error-handling middleware
Using a debug flag
Debugging routes and middleware
Using the V8 debugger
Debugging memory leaks
Adding a REPL to our Express application
Removing debugging commands
Chapter 10: Application Security
Running Express applications on privileged ports
Cross-site request forgery protection
Cross-site scripting
HTTP security headers with Helmet
Handling file uploads
Session middleware parameters
Reauthenticating the user for sensitive operations
Chapter 11: Testing and Improving Code Quality
The importance of having automated tests
Testing toolbox
Creating and testing an Express file-sharing application
Running tests before committing in Git
Code coverage
Complexity analysis of our code
Code linting
Load testing
Client-side testing
Continuous Integration

What You Will Learn

  • Understand the inner workings of the middleware system and build your own
  • Harness and customize middleware for your needs
  • Create RESTful APIs using Express
  • Optimize the performance and throughput of Express web applications
  • Gain an insight into avoiding repeatable code and improve developer productivity
  • Secure, debug, and error-handle your application in a live production environment
  • Improve code quality using existing tools

In Detail

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.


Read More