Build scalable web applications using Node.js, Express.js, and the latest ECMAScript techniques, along with deploying applications with AWS and Docker with this updated fifth edition
▶Book Description
Node.js is the leading choice of server-side web development platform, enabling developers to use the same tools and paradigms for both server-side and client-side software. This updated fifth edition of Node.js Web Development focuses on the new features of Node.js 14, Express 4.x, and ECMAScript, taking you through modern concepts, techniques, and best practices for using Node.js.
The book starts by helping you get to grips with the concepts of building server-side web apps with Node.js. You'll learn how to develop a complete Node.js web app, with a backend database tier to help you explore several databases. You'll deploy the app to real web servers, including a cloud hosting platform built on AWS EC2 using Terraform and Docker Swarm, while integrating other tools such as Redis and NGINX. As you advance, you'll learn about unit and functional testing, along with deploying test infrastructure using Docker. Finally, you'll discover how to harden Node.js app security, use Let's Encrypt to provision the HTTPS service, and implement several forms of app security with the help of expert practices. With each chapter, the book will help you put your knowledge into practice throughout the entire life cycle of developing a web app.
By the end of this Node.js book, you'll have gained practical Node.js web development knowledge and be able to build and deploy your own apps on a public web hosting solution.
▶What You Will Learn
⦁Install and use Node.js 14 and Express 4.17 for both web development and deployment
⦁Implement RESTful web services using the Restify framework
⦁Develop, test, and deploy microservices using Docker, Docker Swarm, and Node.js, on AWS EC2 using Terraform
⦁Get up to speed with using data storage engines such as MySQL, SQLite3, and MongoDB
⦁Test your web applications using unit testing with Mocha, and headless browser testing with Puppeteer
⦁Implement HTTPS using Let's Encrypt and enhance application security with Helmet
▶Key Features
⦁Learn backend web programming with the JavaScript stack
⦁Explore best practices, right from configuring and building web servers to deploying them on a production cloud hosting system: AWS using Docker and Terraform
⦁Work through the different stages of developing robust and scalable apps using Node.js 14
▶Who This Book Is For
If you're looking for an alternative to the 'P' languages (Perl, PHP, and Python), or if you want to get started with server-side web development with JavaScript programming, or if you want a deep dive into deploying services to cloud hosting, this Node.js book is for you. A rudimentary understanding of JavaScript and web application development is a must before you get started with this book.
▶What this book covers
⦁ Chapter 1, About Node.js, introduces you to the Node.js platform. It covers its uses, the technological architecture choices in Node.js, its history, the history of server-side JavaScript, why JavaScript should be liberated from the browser, and important recent advances in the JavaScript scene.
⦁ Chapter 2, Setting Up Node.js, goes over setting up a Node.js developer environment. This includes installing Node.js on Windows, macOS, and Linux. Important tools are covered, including the npm and yarn package management systems and Babel, which is used to transpile modern JavaScript into a form that's runnable on older JavaScript implementations.
⦁ Chapter 3, Exploring Node.js Modules, delves into the module as the unit of modularity in Node.js applications. We will dive deep into understanding and developing Node.js modules and using npm to maintain dependencies. We will learn about the new module format, ES6 modules, and how to use it in Node.js now that it is natively supported.
⦁ Chapter 4, HTTP Servers and Clients, starts exploring web development with Node.js. We will develop several small webserver and client applications in Node.js. We will use the Fibonacci algorithm to explore the effects of heavy-weight, long-running computations on a Node.js application. We will also learn several mitigation strategies and get our first experience with developing REST services.
⦁ Chapter 5, Your First Express Application, begins the main journey of this book, which is developing an application for creating and editing notes. In this chapter, we get a basic notes application running and get started with the Express framework.
⦁ Chapter 6, Implementing the Mobile-First Paradigm, uses the Bootstrap V4 framework to implement responsive web design in the notes application. This includes integrating a popular icon set and the steps required to customize Bootstrap.
⦁ Chapter 7, Data Storage and Retrieval, explores several database engines and a method to easily switch between databases at will. The goal is to robustly persist data to disk.
⦁ Chapter 8, Authenticating Users with a Microservice, adds user authentication to the notes application. We will learn about handling login and logout using PassportJS. Authentication is supported both for locally stored user credentials and for using OAuth with Twitter.
⦁ Chapter 9, Dynamic Client/Server Interaction with Socket.IO, looks at letting our users talk with each other in real time. We will use a popular framework for dynamic interaction between client and server, Socket.IO, to support dynamic updates of content and a simple commenting system. Everything is dynamically updated by users in pseudo-real time, giving us the opportunity to learn about real-time dynamic updating.
⦁ Chapter 10, Deploying Node.js Applications to Linux Servers, is where we begin the deployment journey. In this chapter, we will use the traditional methods of deploying background services on Ubuntu using Systemd.
⦁ Chapter 11, Deploying Node.js Microservices with Docker, sees us start to explore cloudbased deployment using Docker to treat the notes application as a cluster of microservices.
⦁ Chapter 12, Deploying a Docker Swarm to AWS EC2 with Terraform, literally takes us to the cloud by looking at building a cloud hosting system using AWS EC2 systems. We will use a popular tool, Terraform, to create and manage an EC2 cluster, and we will learn how to almost completely automate the deployment of a Docker Swarm cluster using Terraform features.
⦁ Chapter 13, Unit Testing and Functional Testing, has us explore three testing modes: unit testing, REST testing, and functional testing. We will use popular test frameworks, Mocha and Chai, to drive test cases in all three modes. For function testing, we will use Puppeteer, a popular framework for automating test execution in a Chrome instance.