Book description
Create real-time applications using Node.js 10, Docker, MySQL, MongoDB, and Socket.IO with this practical guide and go beyond the developer's laptop to cover live deployment, including HTTPS and hardened security.
About This Book- Learn server-side JavaScript coding through the most up-to-date book on Node.js
- Explore the latest JavaScript features, and EcmaScript modules
- Walk through different stages of developing robust applications using Node.js 10
This book is for anybody looking for an alternative to the "P" languages (Perl, PHP, and Python), or anyone looking for a new paradigm of server-side application development. You should have at least a rudimentary understanding of JavaScript and web application development.
What You Will Learn- Install and use Node.js 10 for both development and deployment
- Use the Express 4.16 application framework
- Work with REST service development using the Restify framework
- Use data storage engines such as MySQL, SQLITE3, and MongoDB
- Use User authentication methods with OAuth2
- Perform Real-time communication with the front-end using Socket.IO
- Implement Docker microservices in development, testing and deployment
- Perform unit testing with Mocha 5.x, and functional testing with Puppeteer 1.1.x
- Work with HTTPS using Let's Encrypt, and application security with Helmet
Node.js is a server-side JavaScript platform using an event-driven, non-blocking I/O model allowing users to build fast and scalable data-intensive applications running in real time.
This book gives you an excellent starting point, bringing you straight to the heart of developing web applications with Node.js. You will progress from a rudimentary knowledge of JavaScript and server-side development to being able to create, maintain, deploy and test your own Node.js application.You will understand the importance of transitioning to functions that return Promise objects, and the difference between fs, fs/promises and fs-extra. With this book you'll learn how to use the HTTP Server and Client objects, data storage with both SQL and MongoDB databases, real-time applications with Socket.IO, mobile-first theming with Bootstrap, microservice deployment with Docker, authenticating against third-party services using OAuth, and use some well known tools to beef up security of Express 4.16 applications.
Style and approachBenefit from an easy, step-by-step approach that really works.
Table of contents
- Title Page
- Copyright and Credits
- Dedication
- Packt Upsell
- Contributors
- Preface
- About Node.js
-
Setting up Node.js
- System requirements
- Installing Node.js using package managers
- Installing from source on POSIX-like systems
- Installing multiple Node.js instances with nvm
- Native code modules and node-gyp
- Node.js versions policy and what to use
- Editors and debuggers
- Running and testing commands
- NPM – the Node.js package manager
- Node.js, ECMAScript 2015/2016/2017, and beyond 
- Summary
-
Node.js Modules
- Defining a module
- Finding and loading CommonJS and JSON modules using require
- Finding and loading ES6 modules using import
- Hybrid CommonJS/Node.js/ES6 module scenarios
-
npm - the Node.js package management system
- The npm package format
- Finding npm packages
- Other npm commands
- Installing an npm package
- Maintaining package dependencies with npm
- Packages that install commands
- Updating outdated packages you've installed
- Installing packages from outside the npm repository
- Initializing a new npm package
- Declaring Node.js version compatibility
- Publishing an npm package
- Explicitly specifying package dependency version numbers
- The Yarn package management system
- Summary
-
HTTP Servers and Clients
- Sending and receiving events with EventEmitters
- HTTP server applications
- ES2015 multiline and template strings
- HTTP Sniffer – listening to the HTTP conversation
- Web application frameworks
- Getting started with Express
- Calculating the Fibonacci sequence with an Express application
- Making HTTP Client requests
- Calling a REST backend service from an Express application
- Summary
- Your First Express Application
-
Implementing the Mobile-First Paradigm
- Problem – the Notes app isn't mobile friendly
- Mobile-first paradigm
- Using Twitter Bootstrap on the Notes application
- Flexbox and CSS Grids
-
Mobile-first design for the Notes application
- Laying the Bootstrap grid foundation
- Responsive page structure for the Notes application
- Using icon libraries and improving visual appeal
- Responsive page header navigation bar
- Improving the Notes list on the front page
- Cleaning up the Note viewing experience
- Cleaning up the add/edit note form
- Cleaning up the delete-note window
- Building a customized Bootstrap
- Summary
- Data Storage and Retrieval
-
Multiuser Authentication the Microservice Way
-
Creating a user information microservice
- User information model
- A REST server for user information
- Scripts to test and administer the user authentication server
-
Login support for the Notes application
- Accessing the user authentication REST API
- Login and logout routing functions
- Login/logout changes to app.js
- Login/logout changes in routes/index.mjs
- Login/logout changes required in routes/notes.mjs
- View template changes supporting login/logout
- Running the Notes application with user authentication
- Twitter login support for the Notes application
- Securely keeping secrets and passwords
- The Notes application stack
- Summary
-
Creating a user information microservice
- Dynamic Client/Server Interaction with Socket.IO
-
Deploying Node.js Applications
- Notes application architecture and deployment considerations
- Traditional Linux Node.js service deployment
-
Node.js microservice deployment with Docker
- Installing Docker on your laptop
-
Creating the AuthNet for the user authentication service
- MySQL container for Docker
- Initializing AuthNet
- Script execution on Windows
- Linking Docker containers
- The db-userauth container
- Dockerfile for the authentication service
- Configuring the authentication service for Docker
- Building and running the authentication service Docker container
- Exploring Authnet
- Creating FrontNet for the Notes application
- Deploying to the cloud with Docker compose
- Deploying to cloud hosting with Docker compose
- Summary
-
Unit Testing and Functional Testing
- Assert – the basis of testing methodologies
- Testing a Notes model
- Using Docker to manage test infrastructure
- Testing REST backend services
- Automating test results reporting
- Frontend headless browser testing with Puppeteer
- Summary
- Security
- Other Books You May Enjoy
Product information
- Title: Node.js Web Development - Fourth Edition
- Author(s):
- Release date: May 2018
- Publisher(s): Packt Publishing
- ISBN: 9781788626859
You might also like
book
Node.js Web Development
Build scalable web applications using Node.js, Express.js, and the latest ECMAScript techniques, along with deploying applications …
book
Mastering Node.js - Second Edition
Expert techniques for building fast servers and scalable, real-time network applications with minimal effort; rewritten for …
book
Node.js in Action, Second Edition
Node.js in Action, Second Edition is a thoroughly revised book based on the best-selling first edition. …
book
Get Programming with Node.js
Get Programming with Node.js Get Programming with Node.js teaches you to write server-side code in JavaScript …