Professional Node.js
Pedro Teixeira
I
Introduction
What is Event-Driven Programming
is
a form of input/output processing that permits other processing to continue before the transmission has finished.
What is first-class function
is
that the language supports constructing new functions during the execution of a program, storing them in data structures, passing them as arguments to other functions, and returning them as the values of other functions.
JavaScript is a powerful language, mainly because it has first-class functions and closures.
What are Closures
Closures
are
functions that inherit variables from their enclosing environment.
This powerful feature is at the heart of Node's success.
II
Node Core API
Modules
use
CommonJS modules system.
Buffer
helps you to
deal with binary data in Node.js.
The standard callback pattern
is
CPS which is a style of programming in which control is passed explicitly in the form of a continuation.
The event emitter pattern
can
trigger event happened multiple times.
process.nextTick()
By using process.nextTick(callback) instead of setTimeout(callback, 0), your callback runs immediately after all the events in the event queue have been processed, which is much sooner than when the JavaScript timeout queue is activated.
III
Files, Processes, Streams, and Networking
path , fs , child_process , stream , net , http , request , dgram , tls , https
IV
Building and Debugging Modules and Applications
tap , assert , console.log , util.format , debugger , node-inspector , async
V
Building Web Applications
connect , express , pug , socket.io , node-http-proxy , redis
Thank you