Thanks to visit codestin.com
Credit goes to subscription.packtpub.com

Sign In Start Free Trial
Account

Add to playlist

Create a Playlist

Modal Close icon
You need to login to use this feature.
  • Book Overview & Buying Node.js Design Patterns
  • Table Of Contents Toc
  • Feedback & Rating feedback
Node.js Design Patterns

Node.js Design Patterns - Fourth Edition

By : Luciano Mammino, Mario Casciaro
5 (1)
close
close
Node.js Design Patterns

Node.js Design Patterns

5 (1)
By: Luciano Mammino, Mario Casciaro

Overview of this book

Node.js underpins much of modern web development, reliably powering APIs and full-stack apps across all industries. Authors Luciano Mammino and Mario Casciaro offer a practical guide that unpacks the JavaScript runtime so you can write reliable, high-performance Node.js apps. Building on the highly rated third edition, this new edition adds fresh case studies and the latest Node.js developments: newer APIs and libraries, ESM improvements, practical security and production tips, and guidance on using Node.js with TypeScript. It also introduces a new chapter on testing that gives you a full introduction to testing philosophy and practical guidance on writing unit, integration, and end-to-end tests, giving you the confidence to write functional, stable, and reliable code. Real-world, end-to-end examples throughout the book show how to build microservices and distributed systems with Node.js, integrating production-proven technologies such as Redis, RabbitMQ, LevelDB, and ZeroMQ, the same components you’ll find in scalable deployments at companies of all sizes. End-of-chapter exercises consolidate your understanding. By the end of this Node.js book, you’ll have the design patterns, mindset, and hands-on skills every serious Node.js professional needs to confidently architect robust, efficient, and maintainable applications.
Table of Contents (16 chapters)
close
close
14
Other Books You May Enjoy
15
Index

Exercises

  • Exercise 10.1: Unit test for a utility function: Create a function called slugify(text) that turns a string into a URL-friendly slug. For example, Hello World! should become hello-world. Write a unit test using Node.js’s built-in test runner to verify the following:
    • The output is lowercase
    • Special characters are removed
    • Multiple spaces or dashes are collapsed into a single dash
  • Exercise 10.2: Test an asynchronous retry function: Implement a function called fetchWithRetry(asyncFn, maxRetries) that retries the given asynchronous function up to maxRetries times if it throws. The asyncFn can be any asynchronous function (e.g., a fetch or database call). If asyncFn eventually succeeds, fetchWithRetry() should resolve to the same value. If it fails on every attempt, it should reject with the last error. Here are some suggestions:
    • Simulate an asyncFn that fails twice and succeeds on the third attempt.
    • ...
Visually different images
CONTINUE READING
83
Tech Concepts
36
Programming languages
73
Tech Tools
Icon Unlimited access to the largest independent learning library in tech of over 8,000 expert-authored tech books and videos.
Icon Innovative learning tools, including AI book assistants, code context explainers, and text-to-speech.
Icon 50+ new titles added per month and exclusive early access to books as they are being written.
Node.js Design Patterns
notes
bookmark Notes and Bookmarks search Search in title playlist Add to playlist download Download options font-size Font size

Change the font size

margin-width Margin width

Change margin width

day-mode Day/Sepia/Night Modes

Change background colour

Close icon Search
Country selected

Close icon Your notes and bookmarks

Confirmation

Modal Close icon
claim successful

Buy this book with your credits?

Modal Close icon
Are you sure you want to buy this book with one of your credits?
Close
YES, BUY

Submit Your Feedback

Modal Close icon
Modal Close icon
Modal Close icon