Node.js Design Patterns Third Edition Exercise Solutions
Pages 3
-
- Chapter 1: The Node.js Platform
- Chapter 2: The Module System
- Chapter 3: Callbacks and Events
- 3.1 A simple event
- 3.2 Ticker
- 3.3 A simple modification
- 3.4 Playing with errors
- Chapter 4: Asynchronous Control Flow Patterns with Callbacks
- 4.1 File concatenation
- 4.2 List files recursively
- 4.3 Recursive find
- Chapter 5: Asynchronous Control Flow Patterns with Promises and Async/Await
- 5.1 Dissecting Promise.all()
- 5.2 TaskQueue with promises
- 5.3 Producer-consumer with promises
- 5.4 An asynchronous map()
- Chapter 6: Coding with Streams
- 6.1 Data compression efficiency
- 6.2 Stream data processing
- 6.3 File share over TCP
- 6.4 Animations with Readable streams
- Chapter 7: Creational Design Patterns
- 7.1 Console color factory
- 7.2 Request builder
- 7.3 A tamper-free queue
- Chapter 8: Structural Design Patterns
- 8.1 HTTP client cache
- 8.2 Timestamped logs
- 8.3 Colored console output
- 8.4 Virtual filesystem
- 8.5 The lazy buffer
- Chapter 9: Behavioral Design Patterns
- Exercise 9.1 Logging with Strategy
- Exercise 9.2 Logging with Template
- Exercise 9.3 Warehouse item
- Exercise 9.4 Logging with Middleware
- Exercise 9.5 Queues with iterators
- Chapter 10: Universal JavaScript for Web Applications
- 10.1 A matter of style
- 10.2 Proper data management
- 10.3 Pagination and search
- 10.4 A Universal... Blog!
- Chapter 11: Advanced Recipes
- 11.1 Proxy with pre-initialization queues
- 11.2 Batching and caching with callbacks
- 11.3 Deep async cancelable
- 11.4 Compute farm
- Chapter 12: Scalability and Architectural Patterns
- 12.1 A scalable book library
- 12.2 Exploring the Z-axis
- 12.3 Music addiction
- Chapter 13: Messaging and Integration Patterns
- 13.1 History service with streams
- 13.2 Multiroom chat
- 13.3 Tasks that stop
- 13.4 Reliable task processing with ZeroMQ
- 13.5 Data aggregator
- 13.6 Worker status CLI
- 13.7 Worker status UI
- 13.8 Pre-initialization queues are back
- 13.9 Request/reply with Redis Streams
- 13.10 Kafka
Clone this wiki locally
In this page, we are collecting solutions for the exercises proposed in the book directly from the readers.
If you have completed some of them and want to share your solution, please edit this page and link your repository (or gist) with the solution.
This is the expected format for a new entry:
- [Solution](<LINK TO YOUR SOLUTION>) ([@<YOUR GITHUB USERNAME>](<YOUR GITHUB PROFILE URL>))
Make sure to use the preview mode, to validate that your entry will be shown correctly!
Thank you!
Chapter 1: The Node.js Platform
No exercise in this chapter
Chapter 2: The Module System
No exercise in this chapter
Chapter 3: Callbacks and Events
3.1 A simple event
- Solution (@enricoschaaf)
- Solution (@kasymbayaman)
- Solution (@hshahsahebi)
- Solution (@jormartin77)
- Solution (@dragons0458)
- Solution (@alvaro-escalante)
- Solution (@levanchien)
3.2 Ticker
- Solution (@enricoschaaf)
- Solution (@stuartambient)
- Solution (@kasymbayaman)
- Solution (@jormartin77)
- Solution [Test] (@chengyil)
- Solution (@dragons0458)
- Solution (@CurtisSlone)
- Solution (@alvaro-escalante)
- Solution (@levanchien)
- Solution (@r2abreu)
3.3 A simple modification
- Solution (@enricoschaaf)
- Solution (@kasymbayaman)
- Solution [Test] (@chengyil)
- Solution (@dragons0458)
- Solution (@alvaro-escalante)
- Solution (@levanchien)
- Solution (@r2abreu)
3.4 Playing with errors
- Solution (@enricoschaaf)
- Solution (@stuartambient)
- Solution (@kasymbayaman)
- Solution (@hshahsahebi)
- Solution [Test] (@chengyil)
- Solution (@dragons0458)
- Solution (@alvaro-escalante)
- Solution (@levanchien)
- Solution (@r2abreu)
Chapter 4: Asynchronous Control Flow Patterns with Callbacks
4.1 File concatenation
- Solution (@enricoschaaf)
- Solution (@kasymbayaman)
- Solution (@hshahsahebi)
- Solution [Test] (@chengyil)
- Solution (@bboydflo)
- Solution(@CurtisSlone)
- Solution (@levanchien)
4.2 List files recursively
- Solution (@enricoschaaf)
- Solution (@MattLongCode)
- Solution (@kasymbayaman)
- Solution (@hshahsahebi)
- Solution (@bboydflo)
- Solution (@hosseinnedaee)
- Solution (@CurtisSlone)
- Solution (@levanchien)
4.3 Recursive find
- Solution (@enricoschaaf)
- Solution (@stuartambient)
- Solution (@Jack-Barry)
- Solution (@kasymbayaman)
- Solution (@hshahsahebi)
- Solution (@bboydflo)
- Solution (@hosseinnedaee)
- Solution (@jurajmajerik)
- Solution (@levanchien)
Chapter 5: Asynchronous Control Flow Patterns with Promises and Async/Await
5.1 Dissecting Promise.all()
- Solution (@enricoschaaf)
- Solution (@Jack-Barry)
- Solution (@CurtisSlone)
- Solution (@levanchien)
- Solution (@kasymbayaman)
5.2 TaskQueue with promises
5.3 Producer-consumer with promises
- Solution (@stuartambient)
- Solution (@hosseinnedaee)
- Solution(@CurtisSlone)
- Solution (@levanchien)
- Solution (@kasymbayaman)
5.4 An asynchronous map()
- Solution (@Jack-Barry)
- Solution (@stuartambient)
- Solution (@nebarf)
- Solution (@hosseinnedaee)
- Solution (@levanchien)
- Solution (@kasymbayaman)
- Solution (@sabry-awad97)
Chapter 6: Coding with Streams
6.1 Data compression efficiency
- Solution (@ahmdsolmn)
- Solution(@CurtisSlone)
- Solution (@hosseinnedaee)
- Solution (@levanchien)
- Solution (@kasymbayaman)
- Solution (@factordog)
6.2 Stream data processing
- Solution (@lomm28)
- Solution(@CurtisSlone)
- Solution (@hosseinnedaee)
- Solution (@levanchien)
- Solution (@kasymbayaman)
- Solution (@factordog)
6.3 File share over TCP
6.4 Animations with Readable streams
Chapter 7: Creational Design Patterns
7.1 Console color factory
7.2 Request builder
7.3 A tamper-free queue
Chapter 8: Structural Design Patterns
8.1 HTTP client cache
8.2 Timestamped logs
8.3 Colored console output
8.4 Virtual filesystem
8.5 The lazy buffer
Chapter 9: Behavioral Design Patterns
Exercise 9.1 Logging with Strategy
- Solution (@nebarf)
- Solution (@davide-88)
- Solution (@CurtisSlone)
- Solution (@levanchien)
- Solution (@kasymbayaman)
Exercise 9.2 Logging with Template
Exercise 9.3 Warehouse item
Exercise 9.4 Logging with Middleware
Exercise 9.5 Queues with iterators
Chapter 10: Universal JavaScript for Web Applications
10.1 A matter of style
10.2 Proper data management
10.3 Pagination and search
No solution yet, please submit yours :)
10.4 A Universal... Blog!
No solution yet, please submit yours :)
Chapter 11: Advanced Recipes
11.1 Proxy with pre-initialization queues
11.2 Batching and caching with callbacks
11.3 Deep async cancelable
11.4 Compute farm
Chapter 12: Scalability and Architectural Patterns
12.1 A scalable book library
No solution yet, please submit yours :)
12.2 Exploring the Z-axis
No solution yet, please submit yours :)
12.3 Music addiction
No solution yet, please submit yours :)
Chapter 13: Messaging and Integration Patterns
13.1 History service with streams
No solution yet, please submit yours :)
13.2 Multiroom chat
No solution yet, please submit yours :)
13.3 Tasks that stop
No solution yet, please submit yours :)
13.4 Reliable task processing with ZeroMQ
No solution yet, please submit yours :)
13.5 Data aggregator
No solution yet, please submit yours :)
13.6 Worker status CLI
No solution yet, please submit yours :)
13.7 Worker status UI
No solution yet, please submit yours :)
13.8 Pre-initialization queues are back
No solution yet, please submit yours :)
13.9 Request/reply with Redis Streams
No solution yet, please submit yours :)
13.10 Kafka
No solution yet, please submit yours :)
For more information on Node.js Design Patterns, check out the official website