Node cookbook practical solutions to server-side JavaScript problems
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 Actionable recipes across the full spectrum of Node.js development Cutting edge techniques and tools for measuring an...
Otros Autores: | |
---|---|
Formato: | Libro electrónico |
Idioma: | Inglés |
Publicado: |
Birmingham, England ; Mumbai, India :
Packt Publishing
2017.
|
Edición: | Third edition |
Materias: | |
Ver en Biblioteca Universitat Ramon Llull: | https://discovery.url.edu/permalink/34CSUC_URL/1im36ta/alma991009630493206719 |
Tabla de Contenidos:
- Cover
- Title Page
- Copyright
- Credits
- Foreword
- About the Authors
- About the Reviewers
- www.PacktPub.com
- Customer Feedback
- About nearForm
- Table of Contents
- Preface
- Chapter 1: Debugging process*
- 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
- Chapter 2: 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
- Chapter 3: 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
- Chapter 4: 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
- Chapter 5: 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
- Chapter 6: 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
- See also...
- 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
- See also...
- 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
- See also
- Storing and retrieving data with Redis
- Getting ready
- How to do it...
- How it works...
- There's more...
- Command batching
- Using Redis
- Authenticating
- See also...
- Embedded persistence with LevelDB
- Getting ready
- How to do it...
- How it works...
- There's more...
- Alternative storage adapters
- See also...
- Chapter 7: 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
- Chapter 8: 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
- Chapter 9: 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
- Chapter 10: Building Microservice Systems
- Introduction.
- Creating a simple RESTful microservice.