
Node.js is a performant platform for web apps which is built on JavaScript—the most popular programming language in the world. If you aspire one day to become a Node.js architect (or maybe you’re already one and want to extend your knowledge), this presentation is for you, because we’ll talk about main Node patterns.
Explore intro and Node basics, understand the differences between Node and JavaScript, and master non-blocking, asynchronous code patterns for scalable, readable team projects.
Explore how to schedule work in the future using callbacks in Node.js, illustrating first-class functions, setTimeout, and the error-first callback conventions.
Control the execution flow with callbacks to enforce the right sequence, avoid nesting by naming functions, check errors at each step, and modularize into separate files or use observers.
Modularize code by using module.exports and exports to expose objects or functions to other files, and export functions for dynamic initialization or function factories.
Explore how node module caching executes code outside a module only once, while code inside runs when you require and invoke a function, demonstrated with a practical, hands-on demo.
Apply the plugin pattern to create a folder with an index.js as an entry point, exporting modules via an abstraction layer for easier require and import, mirroring node module patterns.
Explore the singleton pattern in node by exporting an object, using a private variable, and sharing and preserving state across imports through module caching.
Explore how node modules cache files and how file name casing affects module identity, causing singleton issues. Use the global pattern to attach an app-wide object and colorize console output.
Explore how the function factory pattern creates new objects by returning a function with internal initialization and option-based customization, offering a simple alternative to prototype-based classes.
Decorate objects or prototypes on the fly using the decorator pattern to extend or enhance functionality, such as admin features like add or remove user, without changing the original model.
Explore why non-blocking io can block, and how scheduling cpu-bound tasks across the next cycle improves performance by deferring work.
Explore the middleware pattern in node, a function with a callback that calls next to enable modular, reusable request handling. See how Express structures modules via request, response, and next.
Learn how the observer pattern replaces single callbacks by enabling multiple event listeners that can be added, removed, and executed at any stage of a module without breaking the app.
Explore dependency injection to decouple storage from middleware, using parameterized express session with agnostic, framework-agnostic design, and apply module patterns to configure routes and mount more things.
Discover higher-order functions as function factories that return customizable functions through closures, letting you tailor behavior by arguments while capturing outer scope.
Explore node patterns like hooks, middleware, singleton, and observers; compare functional vs prototype inheritance and function factories; and learn when to use each pattern.
Node.js is this amazing and fast platform built on JavaScript which is the most popular programming language in the world.
Let's say you aspire one day to become a Node.js architect...
Or maybe, you’re already one and want to extend your knowledge,
Work in a full stack JavaScript?
This presentation is for you, because we’ll talk about main Node patterns.
In this presentation, we will start with the basic: what is event loop and callback (setTimeout(), setImmediate() and process.nextTick())....
Then we'll discuss the observer pattern with EventEmitter, the Middleware pattern and the Module patterns.
Next you will learn how to hack object prototype and global refs. We will also discuss factory pattern and pseudo-classical inheritance.
And lastly, we'll tackle Async patterns: Async, NeoAsync, async await, generators and Promises.
Wait no more and engage into learning and taking the max out of your Node code!