Book Image

Advanced Express Web Application Development

By : Andrew Keig
Book Image

Advanced Express Web Application Development

By: Andrew Keig

Overview of this book

Building an Express application that is reliable, robust, maintainable, testable, and can scale beyond a single server requires a bit of extra thought and effort. Express applications that need to survive in a production environment will need to reach out to the Node ecosystem and beyond, for support.You will start by laying the foundations of your software development journey, as you drive-out features under test. You will move on quickly to expand on your existing knowledge, learning how to create a web API and a consuming client. You will then introduce a real-time element in your application.Following on from this, you will begin a process of incrementally improving your application as you tackle security, introduce SSL support, and how to handle security vulnerabilities. Next, the book will take you through the process of scaling and then decoupling your application. Finally, you will take a look at various ways you can improve your application's performance and reliability.
Table of Contents (14 chapters)
Advanced Express Web Application Development
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Preface

Building an Express application that is reliable, robust, maintainable, testable, and can scale beyond a single server requires a bit of extra thought and effort. Express applications that need to survive in a production environment will need to reach out to the Node ecosystem and beyond for support. Advanced Express Web Application Development aims to deliver a working real-world, single-page application that can meet these goals and allow us the opportunity to explore the more advanced features of Express.

What this book covers

Chapter 1, Foundations, lays the foundation as we put in place a skeleton application; we introduce testing and automation practices that we will use to build our example single-page application.

Chapter 2, Building a Web API, helps in building a web API that our application will consume.

Chapter 3, Templating, helps you create a consuming client with a working web API in place and explore the client- and server-side templating.

Chapter 4, Real-time Communication, helps us to add real-time updates to content displayed in our single-page application.

Chapter 5, Security, guides us to secure our application as we look at authentication, security vulnerabilities, and SSL.

Chapter 6, Scaling, demonstrates scaling our Express application using Redis, and also looks at the benefits of decoupling an Express application.

Chapter 7, Production, examines real-world Express deployment issues such as performance, robustness, and reliability.

What you need for this book

In order to create and run the examples in this book, you will need a Mac or PC running Windows or Linux; you can use any text editor. This book will provide you with instructions on installing Node.js, Express, and various dependencies including Redis and MongoDB.

Who this book is for

If you are an experienced JavaScript developer who wants to build highly scalable, real-world applications using Express, this book is ideal for you. This book is an advanced title and assumes that the reader has some experience with Node.js, JavaScript MVC web development frameworks, and has at least heard of Express before. The reader should also have a basic understanding of Redis and MongoDB. This book is not a tutorial on node but aims to explore some of the more advanced topics you will encounter when developing, deploying, and maintaining an Express web application.

Conventions

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: "Let's extract our route heartbeat into ./lib/routes/heartbeat.js; the following listing simply exports the route as a function called index:"

A block of code is set as follows:

exports.index = function(req, res){
     res.json(200, 'OK');
};

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

npm install -g express
NODE_ENV=COVERAGE mocha -R html-cov > coverage.html

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: "In order to acquire a GitHub token, log in to your GitHub account and go to the Accounts section of your Settings page, you will need to enter your password. Now click on Create new token, name the token if you prefer. Click on the copy to clipboard button in order to copy the token into the following login."

Note

Warnings or important notes appear in a box like this.

Tip

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 www.packtpub.com/authors.

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.

Downloading the example code

You can download the example code files for all Packt books you have purchased from your account at http://www.packtpub.com. If you purchased this book elsewhere, you can visit http://www.packtpub.com/support and register to have the files e-mailed directly to you.

Errata

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 http://www.packtpub.com/submit-errata, 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 http://www.packtpub.com/support.

Piracy

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.

Questions

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.