万本电子书0元读

万本电子书0元读

顶部广告

Node Cookbook - Third Edition电子书

售       价:¥

2人正在读 | 0人评论 9.8

作       者:David Mark Clements, Matthias Buus, Matteo Collina,Peter Elger

出  版  社:Packt Publishing

出版时间:2017-07-31

字       数:65.6万

所属分类: 进口书 > 外文原版书 > 电脑/网络

温馨提示:数字商品不支持退换货,不提供源文件,不支持导出打印

为你推荐

  • 读书简介
  • 目录
  • 累计评论(0条)
  • 读书简介
  • 目录
  • 累计评论(0条)
Over 60 high-quality recipes covering debugging, security, performance, microservices, web frameworks, databases, deployment and more; rewritten for Node 4, 6, and 8. About This Book ? Security between Node.js and browser applications explained and applied in depth ? Cutting edge techniques and tools for measuring and improving performance ? Contemporary techniques to create developer-ergonomic, readily-scalable production systems Who This Book Is For If you have good knowledge of JavaScript and want to build fast, efficient, scalable client-server solutions, then this book is for you. Some experience with Node.js is assumed to get the most out of this book. If working from a beginner level Node Cookbook 2nd Edition is recommended as a primer for Node Cookbook 3rd Edition. What You Will Learn ? Rapidly become proficient at debugging Node.js programs ? Write and publish your own Node.js modules ? Become deeply acquainted with 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 infinite-capacity data processing ? Fast-track performance knowledge and optimization abilities ? Compare and contrast various persistence strategies, including database integrations with MongoDB, MySQL/MariaDB, Postgres, Redis, and LevelDB ? Grasp and apply critically essential security concepts ? Understand how to use Node with best-of-breed deployment technologies: Docker, Kubernetes and AWS In Detail The principles of asynchronous event-driven programming are perfect for today's web, where efficient real-time applications and scalability are at the forefront. Server-side JavaScript has been here since the 90s but Node got it right. This edition is a complete rewrite of the original, and is targeted against Node 4, 6, and 8. It shows you how to build fast, efficient, and scalable client-server solutions using the latest versions of Node. Beginning with adopting debugging tips and tricks of the trade and learning how to write your own modules, then covering the fundamentals of streams in Node.js, you will go on to discover I/O control, implementation of various web protocols, you’ll work up to integrating with cross-section of databases such as MongoDB, MySQL/MariaDB, Postgres, Redis, and LevelDB and building web application with Express, Hapi and Koa. You will then learn about security essentials in Node.js and the advanced optimization tools and techniques By the end of the book you should have acquired a level of proficiency that allows you to confidently build a full production-ready and scalable Node.js system. Style and approach This recipe-based practical guide presents each topic with step-by-step instructions on how you can create fast and efficient server side applications using the latest features and capabilities in Node 8 whilst also supporting usage with Node 4 and 6.
目录展开

Title Page

Third Edition

Copyright

Node Cookbook

Third Edition

Credits

About the Authors

About the Reviewers

www.PacktPub.com

Why subscribe?

Customer Feedback

About nearForm

Preface

What this book covers

What you need for this book

Who this book is for

Conventions

Reader feedback

Customer support

Downloading the example code

Errata

Piracy

Questions

Debugging Processes

Introduction

Debugging Node with Chrome Devtools

Getting ready

How to do it...

How it works...

There's more...

Using node-inspector with older node versions

Immediately pausing a process on start

node debug

See also

Enhancing stack trace output

Getting ready

How to do it...

How it works...

There's more...

Infinite stack trace limit in development

Stack trace layout

Asynchronous stack traces

See also

Enabling debug logs

Getting ready

How to do it...

How it works...

There's more...

Instrumenting code with debug

Using debug in production

JSON logging with pino-debug

See also

Enabling core debug logs

Getting ready

How to do it...

How it works...

There's more...

Creating our own NODE_DEBUG flags

Debugging Node core libraries

See also

Writing Modules

Introduction

Scaffolding a module

Getting ready

How to do it...

How it works...

There's more...

Reinitializing

Versioning

See also

Installing dependencies

Getting ready

How to do it...

How it works...

There's more...

Installing development dependencies

Using npm run scripts

Eliminating the need for sudo

See also

Writing module code

Getting ready

How to do it...

How it works...

There's more...

Adding tests

Modernizing syntax

See also

Publishing a module

Getting ready

How to do it...

How it works...

There's more...

Detecting Vulnerabilities

Extraneous dependencies

Prepublish

Decentralized publishing

See also

Using a private repository

Getting ready

How to do it...

How it works...

There's more…

Module caching

Scope registries

See also

Coordinating I/O

Introduction

Interfacing with standard I/O

Getting ready

How to do it...

How it works...

There's more...

Piping

TTY Detection

See also

Working with files

Getting ready

How to do it...

How it works...

There's more...

Asynchronous file operations

Incremental Processing

See also

Fetching metadata

Getting ready

How to do it...

How it works...

There's more...

Getting symlink information

Checking file existence

Manipulating metadata

See also

Watching files and directories

Getting ready

How to do it...

How it works...

There's more...

Watching directories with chokidar

See also

Communicating over sockets

Getting ready

How to do it...

How it works...

There's more...

net sockets are streams

Unix sockets

UDP sockets

See also

Using Streams

Introduction

Processing Big Data

Getting ready

How to do it...

How it works...

There's more...

Types of stream

Processing infinite amounts of data

Flow mode versus pull-based streaming

Understanding stream events

See also

Using the pipe method

Getting ready

How to do it...

How it works...

There's more...

Keeping piped streams alive

See also

Piping streams in production

Getting ready

How to do it...

How it works...

There's more...

Use pumpify to expose pipelines

See also

Creating transform streams

Getting ready

How to do it...

How it works...

There's more...

Transform streams with Node's core stream module

Creating object mode transform streams

See also

Creating readable and writable streams

Getting ready

How to do it...

How it works...

There's more...

Readable and writable streams with Node's core stream module

Core readable streams flow control issue

Composing duplex streams

See also

Decoupling I/O

Getting ready

How to do it...

How it works...

There's more...

Stream destruction

Handling backpressure

See also

Wielding Web Protocols

Introduction

Creating an HTTP server

Getting ready

How to do it...

How it works...

There's more...

Binding to a random free port

Dynamic content

See also

Receiving POST data

Getting ready

How to do it...

How it works...

There's more...

Accepting JSON

See also

Handling file uploads

Getting ready

How to do it...

How it works...

There's more...

Processing all field types in multipart data

Uploading files via PUT

See also

Making an HTTP POST request

Getting ready

How to do it...

How it works...

HTTPS requests

There's more...

Buffering a GET request

Streaming payloads

Multipart POST uploads

See also

Communicating with WebSockets

Getting ready

How to do it...

How it works...

There's more...

Creating a Node.js WebSocket client

See also

Creating an SMTP server

Getting ready

How to do it...

How it works...

There's more...

Making an SMTP client

See also

Persisting to Databases

Introduction

Connecting and sending SQL to a MySQL server

Getting ready

How to do it...

How it works...

There's more...

Avoiding SQL injection

Querying a MySQL database

Connecting and sending SQL to a Postgres server

Getting ready

How to do it...

How it works...

There's more...

Using native bindings

Storing object-modelled data

Storing and retrieving data with MongoDB

Getting ready

How to do it...

How it works...

There's more...

Indexing and aggregation

Updating modifiers, sort, and limit

Storing and retrieving data with Redis

Getting ready

How to do it...

How it works...

There's more...

Command batching

Using Redis

Authenticating

Embedded persistence with LevelDB

Getting ready

How to do it...

How it works...

There's more...

Alternative storage adapters

Working with Web Frameworks

Introduction

Creating an express web app

Getting ready

How to do it...

How it works...

There's more...

Production

Route parameters and POST requests

Creating middleware

See also

Creating a Hapi web app

Getting ready

How to do it...

How it works...

There's more...

Creating a plugin

Label selecting

See also

Creating a Koa web app

Getting ready

How to do it...

How it works...

There's more...

Creating middleware

Performing asynchronous lookups

See also

Adding a view layer

Getting ready

How to do it...

How it works...

There's more...

Adding a view layer to Koa

Adding a view layer to Hapi

ES2015 template strings as views

See also

Adding logging

Getting ready

How to do it...

How it works...

There's more...

Pino transports and prettifying

Logging with Morgan

Logging with Winston

Adding logging to Koa

Adding logging to Hapi

Capturing debug logs with with Pino

See also

Implementing authentication

Getting ready

How to do it...

How it works...

There's more...

Session authentication in Hapi

Session authentication in Koa

See also

Dealing with Security

Introduction

Detecting dependency vulnerabilities

Getting ready

How to do it...

How it works...

There's more...

Module vetting

Restricting core module usage

See also

Hardening headers in web frameworks

Getting ready

How to do it...

How it works...

There's more...

Avoiding fingerprinting

Hardening a core HTTP server

Hardening Koa

Hardening Hapi

See also

Anticipating malicious input

Getting ready

How to do it...

How it works...

There's more...

Buffer safety

Dealing with JSON pollution

See also

Guarding against cross site scripting (XSS)

Getting ready

How to do it...

How it works...

There's more...

Preventing protocol-handler-based XSS

Parameter validation

Escaping in JavaScript contexts

See also

Preventing cross site request forgery

Getting ready

How to do it...

How it works...

There's more...

Securing older browsers

See also

Optimizing Performance

Introduction

Benchmarking HTTP

Getting ready

How to do it...

How it works...

There's more...

Profiling for production

Measuring POST performance

See also

Finding bottlenecks with flamegraphs

Getting ready

How to do it...

How it works...

There's more...

Finding a solution

How 0x works

CPU profiling with Chrome Devtools

See also

Optimizing a synchronous function call

Getting ready

How to do it...

How it works...

There's more...

Function inlining

Checking the optimization status

Tracing optimization and deoptimization events

See also

Optimizing asynchronous callbacks

Getting ready

How to do it...

How it works...

There's more...

A database solution

A caching solution

See also

Profiling memory

Getting ready

How to do it...

How it works...

There's more...

Visualizing memory usage in the Terminal

See also

Building Microservice Systems

Introduction

Creating a simple RESTful microservice

Getting ready

How to do it...

How it works...

There's more...

Using the core HTTP module

Testing microservices with a browser

See also

Consuming a service

Getting ready

How to do it...

How it works...

There's more...

Integration testing

See also

Setting up a development environment

Getting ready

How to do it...

How it works...

There's more...

A minimal alternative to fuge

Debug command

Shell pass through

Apply command

See also

Standardizing service boilerplate

Getting ready

How to do it...

How it works...

There's more...

Unit testing

Pattern routing

See also

Using containerized infrastructure

Getting ready

How to do it...

How it works...

There's more...

Running containers in the background

See also

Service discovery with DNS

Getting ready

How to do it...

How it works...

There's more...

Alternative service discovery mechanisms

Viewing the environment and DNS Zone

See also

Adding a Queue Based Service

Getting ready

How to do it...

How it works...

Single responsibility

Loose coupling

Vertical separation

Stateless

A note on security

There's more...

Entering a containers shell environment

Saving container state

Cleaning up containers

See also

Deploying Node.js

Introduction

Building a container for a Node.js process

Getting ready

How to do it...

How it works...

There's more...

Viewing the layers in a Docker image

Adding a new layer

Docker alternatives & container standards

See also

Running a Docker registry

Getting ready

How to do it...

Linux troubleshooting

How it works...

There's more...

Tagging

See also

Storing images on DockerHub

Getting ready

How to do it...

How it works...

There's more...

Using a specific version tag

See also

Deploying a container to Kubernetes

Getting ready

How to do it...

How it works...

There's more...

Using the minikube dashboard

Pushing microservice updates into Kubernetes

See also

Creating a deployment pipeline

Getting ready

How to do it...

How it works...

There's more...

Debugging the build

Automating the build trigger

See also

Deploying a full system

Getting ready

How to do it...

How it works...

There's more...

Running a report

See also

Deploying to the cloud

Getting ready

How to do it...

How it works...

There's more...

Running the dashboard

Inspecting the kops State Store

See also

累计评论(0条) 0个书友正在讨论这本书 发表评论

发表评论

发表评论,分享你的想法吧!

买过这本书的人还买过

读了这本书的人还在读

回顶部