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


This book is about Express, the popular web framework used by thousands of Node.js developers around the world. It specifically covers the third major version of the framework, commonly referred to as Express 3.

Express has matured considerably since it was first released exactly four years ago. Today it is recognized as one of the best web frameworks for Node.js. Every day new developers from varied backgrounds and experience come to Express for developing their web apps. With its ever-growing popularity, it is about time we had a book on Express.

I wrote a tutorial on Express some time ago that became quite popular online, particularly with those new to Node.js and Express. Ever since, I had a dream of writing a book on Express, which would make no assumptions about the reader's prior experience and knowledge, and still be full of technical details wherever required. The book you are holding in your hands is that dream realized—a book on Express that is both beginner-friendly and technically deep at the same time.

This book covers everything a developer requires to get into serious web development using Express.

What this book covers

Chapter 1, What is Express?, is a beginner-friendly but technically solid introduction to Express and relevant topics for a strong base right at the start.

Chapter 2, Your First Express App, is a practical introduction to building an Express app covering the basics that form the basis of every Express app.

Chapter 3, Understanding Express Routes, explains routes in Express in great detail.

Chapter 4, Response From the Server, covers the various ways an Express app can respond to a request.

Chapter 5, The Jade Templating Language, covers the Jade syntax and its programming capabilities.

Chapter 6, The Stylus CSS Preprocessor, covers the Stylus syntax and its programming capabilities.

Chapter 7, Forms, Cookies, and Sessions, covers how to handle forms, and create cookies and sessions.

Chapter 8, Express in Production, covers important areas to make Express apps production-ready.

What you need for this book

Familiarity with JavaScript, the command line, and interest in the subject are all you need to get the most out of the book. Any new and relevant topics are introduced and explained in an easy-to-understand manner.

Who this book is for

This book is for anyone interested in knowing more about Express—either for developing web applications or just for technical knowledge in general. It is friendly enough for beginners to get started with, at the same time detailed enough to make an excellent refresher for those already familiar with Express who want to know more about it.


In this book, you will find a number of styles of text that distinguish between different kinds of information. Here are some examples of these styles, and an explanation of their meaning.

Code words in text, database table names, folder names, filenames, file extensions, pathnames, dummy URLs, user input, and Twitter handles are shown as follows: "The router middleware is responsible for handling the requests to the app."

A block of code is set as follows:

app.get('/', function(req, res) {
  res.json({message: 'welcome'});

When we wish to draw your attention to a particular part of a code block, the relevant lines or items are set in bold:

var not_found = function(req, res) {
  res.render('404', {title: 'Not Found'});

Any command-line input or output is written as follows:

$ sudo npm install express -g

New terms and important words are shown in bold. Words that you see on the screen, in menus or dialog boxes for example, appear in the text like this: "The server will respond with the appropriate data type based on the Accept header."


Warnings or important notes appear in a box like this.


Tips and tricks appear like this.

Reader feedback

Feedback from our readers is always welcome. Let us know what you think about this book—what you liked or may have disliked. Reader feedback is important for us to develop titles that you really get the most out of.

To send us general feedback, simply send an e-mail to , and mention the book title via the subject of your message.

If there is a topic that you have expertise in and you are interested in either writing or contributing to a book, see our author guide on

Downloading the example code

You can download the example code fi les for all Packt books you have purchased from your account at If you purchased this book elsewhere, you can visit and register to have the fi les e-mailed directly to you.

Customer support

Now that you are the proud owner of a Packt book, we have a number of things to help you to get the most from your purchase.


Although we have taken every care to ensure the accuracy of our content, mistakes do happen. If you find a mistake in one of our books—maybe a mistake in the text or the code—we would be grateful if you would report this to us. By doing so, you can save other readers from frustration and help us improve subsequent versions of this book. If you find any errata, please report them by visiting, selecting your book, clicking on the errata submission form link, and entering the details of your errata. Once your errata are verified, your submission will be accepted and the errata will be uploaded on our website, or added to any list of existing errata, under the Errata section of that title. Any existing errata can be viewed by selecting your title from


Piracy of copyright material on the Internet is an ongoing problem across all media. At Packt, we take the protection of our copyright and licenses very seriously. If you come across any illegal copies of our works, in any form, on the Internet, please provide us with the location address or website name immediately so that we can pursue a remedy.

Please contact us at with a link to the suspected pirated material.

We appreciate your help in protecting our authors, and our ability to bring you valuable content.


You can contact us at if you are having a problem with any aspect of the book, and we will do our best to address it.