Node Cookbook - Third Edition

Over 60 high-quality recipes covering debugging, security, performance, microservices, web frameworks, databases, deployment and more; rewritten for Node.js 8, Node.js 6, and Node.js 4
Preview in Mapt

Node Cookbook - Third Edition

David Mark Clements et al.

Over 60 high-quality recipes covering debugging, security, performance, microservices, web frameworks, databases, deployment and more; rewritten for Node.js 8, Node.js 6, and Node.js 4
Mapt Subscription
FREE
$29.99/m after trial
eBook
$28.00
RRP $39.99
Save 29%
Print + eBook
$49.99
RRP $49.99
What do I get with a Mapt Pro subscription?
  • Unlimited access to all Packt’s 5,000+ eBooks and Videos
  • Early Access content, Progress Tracking, and Assessments
  • 1 Free eBook or Video to download and keep every month after trial
What do I get with an eBook?
  • Download this book in EPUB, PDF, MOBI formats
  • DRM FREE - read and interact with your content when you want, where you want, and how you want
  • Access this title in the Mapt reader
What do I get with Print & eBook?
  • Get a paperback copy of the book delivered to you
  • Download this book in EPUB, PDF, MOBI formats
  • DRM FREE - read and interact with your content when you want, where you want, and how you want
  • Access this title in the Mapt reader
What do I get with a Video?
  • Download this Video course in MP4 format
  • DRM FREE - read and interact with your content when you want, where you want, and how you want
  • Access this title in the Mapt reader
$0.00
$28.00
$49.99
$29.99 p/m after trial
RRP $39.99
RRP $49.99
Subscription
eBook
Print + eBook
Start 14 Day Trial

Frequently bought together


Node Cookbook - Third Edition Book Cover
Node Cookbook - Third Edition
$ 39.99
$ 28.00
Learning Pentaho Data Integration 8 CE - Third Edition Book Cover
Learning Pentaho Data Integration 8 CE - Third Edition
$ 39.99
$ 28.00
Buy 2 for $35.00
Save $44.98
Add to Cart

Book Details

ISBN 139781785880087
Paperback654 pages

Book Description

Today's web demands efficient real-time applications and scalability. Asynchronous event-driven programming is ideal for this, and this is where Node.js comes in. Server-side JavaScript has been here since the 90s, but Node got it right.

With Node for tooling and server-side logic, and a browser-based client-side UI, everything is JavaScript. This leads to rapid, fluid development cycles. The full-stack, single language experience means less context-switching between languages for developers, architects and whole teams.

This book shows you how to build fast, efficient, and scalable client-server solutions using the latest versions of Node.

The book begins with debugging tips and tricks of the trade, and how to write your own modules. Then you'll learn the fundamentals of streams in Node.js, discover I/O control, and how to implement the different web protocols.

You'll find recipes for integrating databases such as MongoDB, MySQL/MariaDB, Postgres, Redis, and LevelDB. We also cover the options for building web application with Express, Hapi and Koa.

You will then learn about security essentials in Node.js and advanced optimization tools and techniques.

By the end of the book you will have acquired the level of expertise to build production-ready and scalable Node.js systems.

The techniques and skills you will learn in this book are based on the best practices developed by nearForm, one of the leaders in Node implementations, who supported the work of the authors on this book.

Table of Contents

Chapter 1: Debugging process*
Introduction
Debugging Node with Chrome Devtools
Enhancing stack trace output
Enabling debug logs
Enabling core debug logs
Chapter 2: Writing Modules
Introduction
Scaffolding a module
Installing dependencies
Writing module code
Publishing a module
Using a private repository
Chapter 3: Coordinating I/O
Introduction
Interfacing with standard I/O
Working with files
Fetching metadata
Watching files and directories
Communicating over sockets
Chapter 4: Using Streams
Introduction
Processing Big Data
Using the pipe method
Piping streams in production
Creating transform streams
Creating readable and writable streams
Decoupling I/O
Chapter 5: Wielding Web Protocols
Introduction
Creating an HTTP server
Receiving POST data
Handling file uploads
Making an HTTP POST request
Communicating with WebSockets
Creating an SMTP server
Chapter 6: Persisting to Databases
Introduction
Connecting and sending SQL to a MySQL server
Connecting and sending SQL to a Postgres server
Storing and retrieving data with MongoDB
Storing and retrieving data with Redis
Embedded persistence with LevelDB
Chapter 7: Working with Web Frameworks
Introduction
Creating an express web app
Creating a Hapi web app
Creating a Koa web app
Adding a view layer
Adding logging
Implementing authentication
Chapter 8: Dealing with Security
Introduction
Detecting dependency vulnerabilities
Hardening headers in web frameworks
Anticipating malicious input
Guarding against Cross Site Scripting (XSS)
Preventing Cross Site Request Forgery
Chapter 9: Optimizing Performance
Introduction
Benchmarking HTTP
Finding bottlenecks with flamegraphs
Optimizing a synchronous function call
Optimizing asynchronous callbacks
Profiling memory
Chapter 10: Building Microservice Systems
Introduction
Consuming a service
Setting up a development environment
Standardizing service boilerplate
Using containerized infrastructure
Service discovery with DNS
Adding a Queue Based Service
Chapter 11: Deploying Node.js
Introduction
Building a container for a Node.js process
Running a Docker registry
Storing images on DockerHub
Deploying a container to Kubernetes
Creating a deployment pipeline
Deploying a full system
Deploying to the cloud

What You Will Learn

  • Debug Node.js programs
  • Write and publish your own Node.js modules
  • Detailed coverage of Node.js core API’s
  • Use web frameworks such as Express, Hapi and Koa for accelerated web application development
  • Apply Node.js streams for low-footprint data processing
  • Fast-track performance knowledge and optimization abilities
  • Persistence strategies, including database integrations with MongoDB, MySQL/MariaDB, Postgres, Redis, and LevelDB
  • Apply critical, essential security concepts
  • Use Node with best-of-breed deployment technologies: Docker, Kubernetes and AWS

Authors

Table of Contents

Chapter 1: Debugging process*
Introduction
Debugging Node with Chrome Devtools
Enhancing stack trace output
Enabling debug logs
Enabling core debug logs
Chapter 2: Writing Modules
Introduction
Scaffolding a module
Installing dependencies
Writing module code
Publishing a module
Using a private repository
Chapter 3: Coordinating I/O
Introduction
Interfacing with standard I/O
Working with files
Fetching metadata
Watching files and directories
Communicating over sockets
Chapter 4: Using Streams
Introduction
Processing Big Data
Using the pipe method
Piping streams in production
Creating transform streams
Creating readable and writable streams
Decoupling I/O
Chapter 5: Wielding Web Protocols
Introduction
Creating an HTTP server
Receiving POST data
Handling file uploads
Making an HTTP POST request
Communicating with WebSockets
Creating an SMTP server
Chapter 6: Persisting to Databases
Introduction
Connecting and sending SQL to a MySQL server
Connecting and sending SQL to a Postgres server
Storing and retrieving data with MongoDB
Storing and retrieving data with Redis
Embedded persistence with LevelDB
Chapter 7: Working with Web Frameworks
Introduction
Creating an express web app
Creating a Hapi web app
Creating a Koa web app
Adding a view layer
Adding logging
Implementing authentication
Chapter 8: Dealing with Security
Introduction
Detecting dependency vulnerabilities
Hardening headers in web frameworks
Anticipating malicious input
Guarding against Cross Site Scripting (XSS)
Preventing Cross Site Request Forgery
Chapter 9: Optimizing Performance
Introduction
Benchmarking HTTP
Finding bottlenecks with flamegraphs
Optimizing a synchronous function call
Optimizing asynchronous callbacks
Profiling memory
Chapter 10: Building Microservice Systems
Introduction
Consuming a service
Setting up a development environment
Standardizing service boilerplate
Using containerized infrastructure
Service discovery with DNS
Adding a Queue Based Service
Chapter 11: Deploying Node.js
Introduction
Building a container for a Node.js process
Running a Docker registry
Storing images on DockerHub
Deploying a container to Kubernetes
Creating a deployment pipeline
Deploying a full system
Deploying to the cloud

Book Details

ISBN 139781785880087
Paperback654 pages
Read More

Read More Reviews

Recommended for You

Node.js Design Patterns - Second Edition Book Cover
Node.js Design Patterns - Second Edition
$ 39.99
$ 28.00
The Node Craftsman Book Book Cover
The Node Craftsman Book
$ 31.99
$ 22.40
Expert Angular 4 Book Cover
Expert Angular 4
$ 39.99
$ 28.00
Building Bots with Node.js Book Cover
Building Bots with Node.js
$ 31.99
$ 22.40
Node.js Web Development - Third Edition Book Cover
Node.js Web Development - Third Edition
$ 35.99
$ 25.20
Vue.js 2 Cookbook Book Cover
Vue.js 2 Cookbook
$ 35.99
$ 25.20