SlideShare a Scribd company logo
Advanced Node.js
Abdulkader BENCHI
The French Leader in
Open Source Software
French leader in Open Source Software
An alternative to proprietary software
Let us start!
expect(NodeJS)to.shallowDeepEqual(JS)
Node's Architecture: V8
● The two most important players in Node's architecture are V8 and libuv.
Node's default VM is, and will continue to be, V8, although V8 is one option
out of many
● One other strong option for a Node's VM is the Chakra engine by
Microsoft. The Chakra engine is what powers the Microsoft Edge web
browser
● JavaScript features that are available in Node are really the JavaScript
features supported by the V8 engine shipped with Node
Node's Architecture: V8
● When Node has a callback to invoke, it simply passes the control into the
V8 engine. When V8 is done with the code in the callback, the control is
passed back to Node.
● V8 is single-threaded, Node cannot execute several JavaScript code, no
matter how many callbacks have been registered
● Node will wait until V8 can handle more operations.
expect(NodeJS)to.onlyProvide(V8)
Node's Architecture: libuv
● Node is more than a wrapper for V8, it provides APIs for working with
operating system files, binary data, networking and much more.
● Node also handles the waiting for asynchronous events for us using libuv.
● Libuv is a C library developed for Node.
● It's used to abstract the non-blocking I/O operations to a consistent
interface across many operating systems.
● Libuv is also what provides Node with the event-loop
Advanced Node.JS Meetup
Concurrency Model and Event Loop
I/O
● Slow I/O operations are handled
with events and callbacks so
that they don't block the main
single-threaded execution
runtime.
● I/O is used to label a
communication between a
process in a computer CPU and
anything external to that CPU,
including memory, disk,
network, and even another
process.
Handling Slow I/O
The Call Stack
● The V8 Call stack which is
simply a list of functions.
● FILO data structure
○ const f1 = () => { f2(); };
○ const f2 = () => { f3(); };
○ const f3 = () => { f4(); };
○ const f4 = () => { f4(); };
● When start dealing with slow
operations, the fact that we
have a single thread becomes a
problem, because these slow
operations will block the
execution.
The Call Stack
const add = (a, b) => a + b;
const double = a => add(a, a);
const printDouble = a => {
const output = double(a);
console.log(output);
};
printDouble(9);
printDouble(9)
double(9)
add(9, 9)
console.log(18)
The Call Stack
const slowAdd = (a, b) => {
for(let i=0; i<999999999; i++) {};
return a + b;
};
const a = slowAdd(3, 3);
const b = slowAdd(4, 4);
console.log(a);
console.log(b);
slowAdd(3, 3)slowAdd(4, 4)console.log(6)console.log(8)
How Callbacks
Actually Work
const slowAdd = (a, b) => {
setTimeout(() => {
console.log(a+b);
}, 5000);
};
slowAdd(3, 3);
slowAdd(4, 4);
slowAdd(3, 3)
setTimeout()
slowAdd(4, 4)
setTimeout()
console.log(6)console.log(8)
What?!
How Callbacks
Actually Work
const slowAdd = (a, b) => {
setTimeout(() => {
console.log(a+b);
}, 5000);
};
slowAdd(3, 3);
slowAdd(4, 4);
slowAdd(3, 3)
setTimeout()
slowAdd(4, 4)
setTimeout()
Call stack Node
Timer cb1
Timer cb2
How Callbacks
Actually Work
const slowAdd = (a, b) => {
setTimeout(() => {
console.log(a+b);
}, 5000);
};
slowAdd(3, 3);
slowAdd(4, 4);
console.log(6)console.log(8)
Call stack Node
Queue
Timer cb1
Timer cb2
cb1 cb2
The Event loop
● Both the Stack and the Heap are
part of the run-time engine V8,
not Node itself.
● Node adds APIs like timers,
emitters, and wrappers around
OS operations. It also provides
the event Queue and the event
loop using the libuv library.
● Event loop = a simple loop that
works between the event queue
and the call stack.
YOLO
JavaScript module system
Look familiar?
module bundlers vs. module loaders
Webpack vs. Browserify
AMD vs. CommonJS
Explain what
modules plz
Good authors divide their books into
chapters and sections
Good programmers divide their
programs into modules.
Module pattern
Module pattern is used to mimic the
concept of classes, so that we can
store both public and private methods
and variables inside a single object 
There are several ways to accomplish
the module pattern
Anonymous closure: our anonymous
function has its own evaluation
environment or “closure”, and then we
immediately evaluate it. This lets us
hide variables from the parent (global)
namespace.
(function ()
{
// We keep these variables private inside this closure scope
var myGrades = [93, 95, 88, 0, 55, 91];
var average = function() {
var total = myGrades.reduce(function(accumulator, item) {
return accumulator + item}, 0);
return 'Your average grade is ' + total / myGrades.length + '.';
}
var failing = function(){
var failingGrades = myGrades.filter(function(item) {
return item < 70;});
return 'You failed ' + failingGrades.length + ' times.';
}
console.log(failing());
}()); // ‘You failed 2 times.’
Have a look again
Remember: in JavaScript, functions
are the only way to create new scope.
Note that the parenthesis around the
anonymous function are required,
because statements that begin with
the keyword function are always
considered to be function declarations
Remember, you can’t have unnamed
function declarations in JavaScript
The surrounding parentheses create a
function expression instead.
(function ()
{
// We keep these variables private inside this closure scope
var myGrades = [93, 95, 88, 0, 55, 91];
var average = function() {
var total = myGrades.reduce(function(accumulator, item) {
return accumulator + item}, 0);
return 'Your average grade is ' + total / myGrades.length + '.';
}
var failing = function(){
var failingGrades = myGrades.filter(function(item) {
return item < 70;});
return 'You failed ' + failingGrades.length + ' times.';
}
console.log(failing());
}()); // ‘You failed 2 times.’
Why do I need a module pattern
As a developer, you need to know the right dependency order to load your files
in. For instance, let’s say you’re using Backbone in your project, so you include
the script tag for Backbone’s source code in your file.
However, since Backbone has a hard dependency on Underscore.js, the script
tag for the Backbone file can’t be placed before the Underscore.js file.
As a developer, managing dependencies and getting these things right can
sometimes be a headache.
Why do I need a module pattern
Namespace collisions: For example,
● what if two of your modules have the same name?
● Or what if you have two versions of a module, and you need both?
CommonJS
A CommonJS module is essentially a reusable piece of JavaScript which
exports specific objects, making them available for other modules to require in
their programs.
If you’ve programmed in Node.js, you’ll be very familiar with this format.
In CommonJS, we use the module.exports object to expose modules, and
require to import them.
What to notice
CommonJS takes a server-first
approach and synchronously loads
modules.
This matters because if we have three
other modules we need to require, it’ll
load them one by one.
Now, that works great on the server
but, unfortunately, makes it harder to
use when writing JavaScript for the
browser.
AMD
CommonJS is all well and good, but what if we want to load modules
asynchronously? The answer is called Asynchronous Module Definition (AMD)
define(['myModule', 'myOtherModule'], function(myModule, myOtherModule) {
console.log(myModule.hello());
});
Define function takes an array of each of the module’s dependencies.
These dependencies are loaded in the background (in a non-blocking manner),
and once loaded define calls the callback function it was given.
What to notice
Unlike CommonJS, AMD takes a
browser-first approach alongside
asynchronous behavior to get the job
done.
Another benefit of AMD is that your
modules can be objects, functions,
constructors, strings, JSON and many
other types, while CommonJS only
supports objects as modules.
That being said, AMD isn’t compatible
with io, filesystem, and other
server-oriented features available via
CommonJS
UMD
For projects that require you to
support both AMD and CommonJS
features, there’s yet another format:
Universal Module Definition (UMD).
UMD essentially creates a way to use
either of the two, while also supporting
the global variable definition.
UMD modules are capable of working
on both client and server.
Back to NodeJS
Back to CommonJS
require(‘something’)
Node uses two core modules for
managing module dependencies:
● require
● module
How do I access them:
● Are they global?
● no need to require('require')
● no need to require('module')
Resolving: To find the absolute path of the file.
Loading: To determine the type of the file content.
Wrapping: To give the file its private scope. This is what makes both the require
and module objects local to every file we require.
Evaluating: This is what the VM eventually does with the loaded code.
Caching: So that when we require this file again, we don’t go over all the steps
another time.
Resolving a local
path
Every module object gets an id
property to identify it. This id is usually
the full path to the file, but in a REPL
session it’s simply <repl>.
Node modules have a one-to-one
relation with files on the file-system.
We require a module by loading the
content of a file into memory.
~/learn-node $ node
> module
Module {
id: '<repl>',
exports: {},
parent: undefined,
filename: null,
loaded: false,
children: [],
paths: [ ... ] }
require('find-me');
Node will look for find-me.js in all the
paths specified by module.paths
The paths list is basically a list of
node_modules directories under every
directory from the current directory to
the root directory.
If Node can’t find find-me.js in any of
these paths, it will throw a “cannot find
module error.”
~/learn-node $ node
> module.paths
[ '/Users/kader/learn-node/repl/node_modules',
'/Users/kader/learn-node/node_modules',
'/Users/kader/node_modules',
'/Users/node_modules',
'/node_modules',
'/Users/kader/.node_modules',
'/Users/kader/.node_libraries']
require.resolve
If you want to only resolve the module
and not execute it, you can use the
require.resolve function
This behaves exactly the same as the
main require function, but does not
load the file.
> require.resolve('find-me');
'/Users/kader/learn-node/node_modules/find-me/start.js'
> require.resolve('not-there');
Error: Cannot find module 'not-there'
at Function.Module._resolveFilename (module.js:470:15)
at Function.resolve (internal/module.js:27:19)
at repl:1:9
at ContextifyScript.Script.runInThisContext (vm.js:23:33)
at REPLServer.defaultEval (repl.js:336:29)
at bound (domain.js:280:14)
at REPLServer.runBound [as eval] (domain.js:293:12)
at REPLServer.onLine (repl.js:533:10)
at emitOne (events.js:101:20)
at REPLServer.emit (events.js:191:7)
Parent-child relation between files
// learn-node/lib/util.js
console.log('In util', module);
//learn-node/index.js
console.log('In index', module);
require('./lib/util');"
~/learn-node $ node index.js
In index Module {
id: '.',
exports: {},
parent: null,
filename: '/Users/kader/learn-node/index.js',
loaded: false,
children: [],
paths: [ ... ] }
In util Module {
id: '/Users/kader/learn-node/lib/util.js',
exports: {},
parent:
Module {
id: '.',
exports: {},
parent: null,
filename: '/Users/kader/learn-node/index.js',
loaded: false,
children: [ [Circular] ],
paths: [...] },
filename: '/Users/kader/learn-node/lib/util.js',
loaded: false,
children: [],
paths: [...] }
Parent-child relation
Main index module (id: '.') is now listed
as the parent for the lib/util module.
However, the lib/util module was not
listed as a child of the index module.
Instead, we have the [Circular] value
there because this is a circular
reference.
!infinite loop
~/learn-node $ node index.js
In index Module {
id: '.',
exports: {},
parent: null,
filename: '/Users/kader/learn-node/index.js',
loaded: false,
children: [],
paths: [ ... ] }
In util Module {
id: '/Users/kader/learn-node/lib/util.js',
exports: {},
parent:
Module {
id: '.',
exports: {},
parent: null,
filename: '/Users/kader/learn-node/index.js',
loaded: false,
children: [ [Circular] ],
paths: [...] },
filename: '/Users/kader/learn-node/lib/util.js',
loaded: false,
children: [],
paths: [...] }
exports,
module.exports
Notice the exports property
So let us try this:
// Add this to lib/util.js
exports.id = 'lib/util';
// Add this to index.js
exports.id = 'index';
~/learn-node $ node index.js
In index Module {
id: '.',
exports: {},
parent: null,
filename: '/Users/kader/learn-node/index.js',
loaded: false,
children: [],
paths: [ ... ] }
In util Module {
id: '/Users/kader/learn-node/lib/util.js',
exports: {},
parent:
Module {
id: '.',
exports: {},
parent: null,
filename: '/Users/kader/learn-node/index.js',
loaded: false,
children: [ [Circular] ],
paths: [...] },
filename: '/Users/kader/learn-node/lib/util.js',
loaded: false,
children: [],
paths: [...] }
~/learn-node $ node index.js
In index Module {
id: '.',
exports: { id: 'index' },
parent: null,
filename: '/Users/kader/learn-node/index.js',
loaded: false,
children: [],
paths: [ ... ] }
In util Module {
id: '/Users/kader/learn-node/lib/util.js',
exports: { id: 'lib/util' },
parent:
Module {
id: '.',
exports: { id: 'index' }
parent: null,
filename: '/Users/kader/learn-node/index.js',
loaded: false,
children: [ [Circular] ],
paths: [...] },
filename: '/Users/kader/learn-node/lib/util.js',
loaded: false,
children: [],
paths: [...] }
exports,
module.exports
Exports variable inside each module is
just a reference to module.exports.
When we reassign the exports variable,
that reference is lost and we would be
introducing a new variable instead of
changing the module.exports object.
The module.exports object in every
module is what the require function
returns when we require that module.
~/learn-node $ node index.js
In index Module {
id: '.',
exports: { id: 'index' },
parent: null,
filename: '/Users/kader/learn-node/index.js',
loaded: false,
children: [],
paths: [ ... ] }
In util Module {
id: '/Users/kader/learn-node/lib/util.js',
exports: { id: 'lib/util' },
parent:
Module {
id: '.',
exports: { id: 'index' }
parent: null,
filename: '/Users/kader/learn-node/index.js',
loaded: false,
children: [ [Circular] ],
paths: [...] },
filename: '/Users/kader/learn-node/lib/util.js',
loaded: false,
children: [],
paths: [...] }
loading
Loaded = false
The module module uses the loaded
attribute to track which modules have
been loaded (true value) and which
modules are still being loaded (false
value).
We can, for example, see the index.js
module fully loaded if we print its module
object on the next cycle of the event loop
using a setImmediate call
The exports object becomes complete
when Node finishes loading the module
(and labels it so).
~/learn-node $ node index.js
In index Module {
id: '.',
exports: {},
parent: null,
filename: '/Users/kader/learn-node/index.js',
loaded: false,
children: [],
paths: [ ... ] }
In util Module {
id: '/Users/kader/learn-node/lib/util.js',
exports: {},
parent:
Module {
id: '.',
exports: {},
parent: null,
filename: '/Users/kader/learn-node/index.js',
loaded: false,
children: [ [Circular] ],
paths: [...] },
filename: '/Users/kader/learn-node/lib/util.js',
loaded: false,
children: [],
paths: [...] }
loading
The exports object becomes complete
when Node finishes loading the module
(and labels it so).
The whole process of requiring/loading a
module is synchronous.
This also means that we cannot change
the exports object asynchronously.
fs.readFile('/etc/passwd', (err, data) => {
if (err) throw err;
exports.data = data; // Will not work.
});
Wrapping
In a browser, when we declare a variable in a script like this: var answer = 42;
That answer variable will be globally available in all scripts after the script that
defined it.
This is not the case in Node, So how come variables in Node are magically
scoped?
Wrapping
The answer is simple. Before compiling
a module, Node wraps the module code
in a function
The wrapper function can be inspected
using the wrapper property of the
module module.
~ $ node
> require('module').wrapper
[ '(function (exports, require, module, __filename, __dirname) { ',
'n});' ]
>
Wrapping
Node does not execute any code you
write in a file directly. It executes this
wrapper function which will have your
code in its body.
This wrapper function has 5 arguments:
exports, require, module, __filename, and
__dirname.
This is what makes them appear to look
global when in fact they are specific to
each module.
~ $ node
> require('module').wrapper
[ '(function (exports, require, module, __filename, __dirname) { ',
'n});' ]
>
Wrapping
exports is defined as a reference to
module.exports prior to that.
What happens is roughly equivalent to:
function (require, module, __filename, __dirname) {
let exports = module.exports;
// Your Code…
return module.exports;
}
The require object
It’s an object that acts mainly as a
function that takes a module name or
path and returns the module.exports
object.
We can simply override the require
object with our own logic if we want to.
Now, every require('something') call in
the script will just return the mocked
object.
require = function() {
return { mocked: true };
}
The require object
The require object also has properties of
its own.
require.main which can be helpful to
determine if the script is being required
or run directly.
require('module').do();
require.main !== module
node module
require.main === module
if (require.main === module) {
// The file is being executed directly (not with require)
}
What is the output?
function yolo() {
console.log('yolo');
}
console.log('Hello there')
module.exports = {
yolo
}
require('./test').yolo();
require('./test').yolo();
Caching
All modules will be cached
Node caches the first call and does not load
the file on the second call.
We can see this cache by printing
require.cache after the first require.
We can simply delete a property from that
require.cache object to invalidate that cache.
function yolo() {
console.log('yolo');
}
console.log('Hello there')
module.exports = {
yolo
}
require('./test').yolo();
delete require.cache[require.resolve('./test')]
require('./test').yolo();
Join us
https://job.linagora.com
Follow us!
Next Meetup : Kaldi
Au programme : Intelligence Artificielle et Machine Learning, Deep Learning, Reconnaissance Automatique
de la Parole (RAP), le challenge de la parole spontanée, variabilité du vocabulaire, du locuteur et de
l'environnement, Kaldi : de la théorie à la pratique, Deep Learning en pratique : application à la RAP,
échanges autour d'un cocktail !
Happy to discuss with you
Ad

More Related Content

What's hot (20)

WebAssembly Overview
WebAssembly OverviewWebAssembly Overview
WebAssembly Overview
Alexandr Skachkov
 
NodeJS for Beginner
NodeJS for BeginnerNodeJS for Beginner
NodeJS for Beginner
Apaichon Punopas
 
Cluster-as-code. The Many Ways towards Kubernetes
Cluster-as-code. The Many Ways towards KubernetesCluster-as-code. The Many Ways towards Kubernetes
Cluster-as-code. The Many Ways towards Kubernetes
QAware GmbH
 
대용량 분산 아키텍쳐 설계 #3 대용량 분산 시스템 아키텍쳐
대용량 분산 아키텍쳐 설계 #3 대용량 분산 시스템 아키텍쳐대용량 분산 아키텍쳐 설계 #3 대용량 분산 시스템 아키텍쳐
대용량 분산 아키텍쳐 설계 #3 대용량 분산 시스템 아키텍쳐
Terry Cho
 
11st Legacy Application의 Spring Cloud 기반 MicroServices로 전환 개발 사례
11st Legacy Application의 Spring Cloud 기반 MicroServices로 전환 개발 사례11st Legacy Application의 Spring Cloud 기반 MicroServices로 전환 개발 사례
11st Legacy Application의 Spring Cloud 기반 MicroServices로 전환 개발 사례
YongSung Yoon
 
Docker swarm introduction
Docker swarm introductionDocker swarm introduction
Docker swarm introduction
Evan Lin
 
multi-thread 어플리케이션에 대해 모든 개발자가 알아 두지 않으면 안 되는 것
multi-thread 어플리케이션에 대해 모든 개발자가 알아 두지 않으면 안 되는 것multi-thread 어플리케이션에 대해 모든 개발자가 알아 두지 않으면 안 되는 것
multi-thread 어플리케이션에 대해 모든 개발자가 알아 두지 않으면 안 되는 것
흥배 최
 
Reactive Programming for a demanding world: building event-driven and respons...
Reactive Programming for a demanding world: building event-driven and respons...Reactive Programming for a demanding world: building event-driven and respons...
Reactive Programming for a demanding world: building event-driven and respons...
Mario Fusco
 
Everything You Need To Know About Persistent Storage in Kubernetes
Everything You Need To Know About Persistent Storage in KubernetesEverything You Need To Know About Persistent Storage in Kubernetes
Everything You Need To Know About Persistent Storage in Kubernetes
The {code} Team
 
nexus helm 설치, docker/helm repo 설정과 예제
nexus helm 설치, docker/helm repo 설정과 예제nexus helm 설치, docker/helm repo 설정과 예제
nexus helm 설치, docker/helm repo 설정과 예제
choi sungwook
 
High Availability for OpenStack
High Availability for OpenStackHigh Availability for OpenStack
High Availability for OpenStack
Kamesh Pemmaraju
 
이벤트 기반 분산 시스템을 향한 여정
이벤트 기반 분산 시스템을 향한 여정이벤트 기반 분산 시스템을 향한 여정
이벤트 기반 분산 시스템을 향한 여정
Arawn Park
 
Quarkus - a next-generation Kubernetes Native Java framework
Quarkus - a next-generation Kubernetes Native Java frameworkQuarkus - a next-generation Kubernetes Native Java framework
Quarkus - a next-generation Kubernetes Native Java framework
SVDevOps
 
당근마켓에서 IaC경험
당근마켓에서 IaC경험당근마켓에서 IaC경험
당근마켓에서 IaC경험
용진 조
 
[OpenStack Days Korea 2016] Track1 - Monasca를 이용한 Cloud 모니터링
[OpenStack Days Korea 2016] Track1 - Monasca를 이용한 Cloud 모니터링[OpenStack Days Korea 2016] Track1 - Monasca를 이용한 Cloud 모니터링
[OpenStack Days Korea 2016] Track1 - Monasca를 이용한 Cloud 모니터링
OpenStack Korea Community
 
Message Queue 가용성, 신뢰성을 위한 RabbitMQ Server, Client 구성
Message Queue 가용성, 신뢰성을 위한 RabbitMQ Server, Client 구성Message Queue 가용성, 신뢰성을 위한 RabbitMQ Server, Client 구성
Message Queue 가용성, 신뢰성을 위한 RabbitMQ Server, Client 구성
Yoonjeong Kwon
 
MySQL Database Architectures - MySQL InnoDB ClusterSet 2021-11
MySQL Database Architectures - MySQL InnoDB ClusterSet 2021-11MySQL Database Architectures - MySQL InnoDB ClusterSet 2021-11
MySQL Database Architectures - MySQL InnoDB ClusterSet 2021-11
Kenny Gryp
 
Understanding Reactive Programming
Understanding Reactive ProgrammingUnderstanding Reactive Programming
Understanding Reactive Programming
Andres Almiray
 
Jenkins tutorial
Jenkins tutorialJenkins tutorial
Jenkins tutorial
Mamun Rashid, CCDH
 
Quarkus k8s
Quarkus   k8sQuarkus   k8s
Quarkus k8s
Georgios Andrianakis
 
Cluster-as-code. The Many Ways towards Kubernetes
Cluster-as-code. The Many Ways towards KubernetesCluster-as-code. The Many Ways towards Kubernetes
Cluster-as-code. The Many Ways towards Kubernetes
QAware GmbH
 
대용량 분산 아키텍쳐 설계 #3 대용량 분산 시스템 아키텍쳐
대용량 분산 아키텍쳐 설계 #3 대용량 분산 시스템 아키텍쳐대용량 분산 아키텍쳐 설계 #3 대용량 분산 시스템 아키텍쳐
대용량 분산 아키텍쳐 설계 #3 대용량 분산 시스템 아키텍쳐
Terry Cho
 
11st Legacy Application의 Spring Cloud 기반 MicroServices로 전환 개발 사례
11st Legacy Application의 Spring Cloud 기반 MicroServices로 전환 개발 사례11st Legacy Application의 Spring Cloud 기반 MicroServices로 전환 개발 사례
11st Legacy Application의 Spring Cloud 기반 MicroServices로 전환 개발 사례
YongSung Yoon
 
Docker swarm introduction
Docker swarm introductionDocker swarm introduction
Docker swarm introduction
Evan Lin
 
multi-thread 어플리케이션에 대해 모든 개발자가 알아 두지 않으면 안 되는 것
multi-thread 어플리케이션에 대해 모든 개발자가 알아 두지 않으면 안 되는 것multi-thread 어플리케이션에 대해 모든 개발자가 알아 두지 않으면 안 되는 것
multi-thread 어플리케이션에 대해 모든 개발자가 알아 두지 않으면 안 되는 것
흥배 최
 
Reactive Programming for a demanding world: building event-driven and respons...
Reactive Programming for a demanding world: building event-driven and respons...Reactive Programming for a demanding world: building event-driven and respons...
Reactive Programming for a demanding world: building event-driven and respons...
Mario Fusco
 
Everything You Need To Know About Persistent Storage in Kubernetes
Everything You Need To Know About Persistent Storage in KubernetesEverything You Need To Know About Persistent Storage in Kubernetes
Everything You Need To Know About Persistent Storage in Kubernetes
The {code} Team
 
nexus helm 설치, docker/helm repo 설정과 예제
nexus helm 설치, docker/helm repo 설정과 예제nexus helm 설치, docker/helm repo 설정과 예제
nexus helm 설치, docker/helm repo 설정과 예제
choi sungwook
 
High Availability for OpenStack
High Availability for OpenStackHigh Availability for OpenStack
High Availability for OpenStack
Kamesh Pemmaraju
 
이벤트 기반 분산 시스템을 향한 여정
이벤트 기반 분산 시스템을 향한 여정이벤트 기반 분산 시스템을 향한 여정
이벤트 기반 분산 시스템을 향한 여정
Arawn Park
 
Quarkus - a next-generation Kubernetes Native Java framework
Quarkus - a next-generation Kubernetes Native Java frameworkQuarkus - a next-generation Kubernetes Native Java framework
Quarkus - a next-generation Kubernetes Native Java framework
SVDevOps
 
당근마켓에서 IaC경험
당근마켓에서 IaC경험당근마켓에서 IaC경험
당근마켓에서 IaC경험
용진 조
 
[OpenStack Days Korea 2016] Track1 - Monasca를 이용한 Cloud 모니터링
[OpenStack Days Korea 2016] Track1 - Monasca를 이용한 Cloud 모니터링[OpenStack Days Korea 2016] Track1 - Monasca를 이용한 Cloud 모니터링
[OpenStack Days Korea 2016] Track1 - Monasca를 이용한 Cloud 모니터링
OpenStack Korea Community
 
Message Queue 가용성, 신뢰성을 위한 RabbitMQ Server, Client 구성
Message Queue 가용성, 신뢰성을 위한 RabbitMQ Server, Client 구성Message Queue 가용성, 신뢰성을 위한 RabbitMQ Server, Client 구성
Message Queue 가용성, 신뢰성을 위한 RabbitMQ Server, Client 구성
Yoonjeong Kwon
 
MySQL Database Architectures - MySQL InnoDB ClusterSet 2021-11
MySQL Database Architectures - MySQL InnoDB ClusterSet 2021-11MySQL Database Architectures - MySQL InnoDB ClusterSet 2021-11
MySQL Database Architectures - MySQL InnoDB ClusterSet 2021-11
Kenny Gryp
 
Understanding Reactive Programming
Understanding Reactive ProgrammingUnderstanding Reactive Programming
Understanding Reactive Programming
Andres Almiray
 

Viewers also liked (20)

Blockchain Economic Theory
Blockchain Economic TheoryBlockchain Economic Theory
Blockchain Economic Theory
Melanie Swan
 
Cs231n 2017 lecture10 Recurrent Neural Networks
Cs231n 2017 lecture10 Recurrent Neural NetworksCs231n 2017 lecture10 Recurrent Neural Networks
Cs231n 2017 lecture10 Recurrent Neural Networks
Yanbin Kong
 
Deep Learning Explained
Deep Learning ExplainedDeep Learning Explained
Deep Learning Explained
Melanie Swan
 
Venkatesh Duppada - 2017 - SeerNet at EmoInt-2017: Tweet Emotion Intensity Es...
Venkatesh Duppada - 2017 - SeerNet at EmoInt-2017: Tweet Emotion Intensity Es...Venkatesh Duppada - 2017 - SeerNet at EmoInt-2017: Tweet Emotion Intensity Es...
Venkatesh Duppada - 2017 - SeerNet at EmoInt-2017: Tweet Emotion Intensity Es...
Association for Computational Linguistics
 
Neural Models for Document Ranking
Neural Models for Document RankingNeural Models for Document Ranking
Neural Models for Document Ranking
Bhaskar Mitra
 
Satoshi Sonoh - 2015 - Toshiba MT System Description for the WAT2015 Workshop
Satoshi Sonoh - 2015 - Toshiba MT System Description for the WAT2015 WorkshopSatoshi Sonoh - 2015 - Toshiba MT System Description for the WAT2015 Workshop
Satoshi Sonoh - 2015 - Toshiba MT System Description for the WAT2015 Workshop
Association for Computational Linguistics
 
John Richardson - 2015 - KyotoEBMT System Description for the 2nd Workshop on...
John Richardson - 2015 - KyotoEBMT System Description for the 2nd Workshop on...John Richardson - 2015 - KyotoEBMT System Description for the 2nd Workshop on...
John Richardson - 2015 - KyotoEBMT System Description for the 2nd Workshop on...
Association for Computational Linguistics
 
Deep Learning for Chatbot (3/4)
Deep Learning for Chatbot (3/4)Deep Learning for Chatbot (3/4)
Deep Learning for Chatbot (3/4)
Jaemin Cho
 
Zhongyuan Zhu - 2015 - Evaluating Neural Machine Translation in English-Japan...
Zhongyuan Zhu - 2015 - Evaluating Neural Machine Translation in English-Japan...Zhongyuan Zhu - 2015 - Evaluating Neural Machine Translation in English-Japan...
Zhongyuan Zhu - 2015 - Evaluating Neural Machine Translation in English-Japan...
Association for Computational Linguistics
 
Chenchen Ding - 2015 - NICT at WAT 2015
Chenchen Ding - 2015 - NICT at WAT 2015Chenchen Ding - 2015 - NICT at WAT 2015
Chenchen Ding - 2015 - NICT at WAT 2015
Association for Computational Linguistics
 
John Richardson - 2015 - KyotoEBMT System Description for the 2nd Workshop on...
John Richardson - 2015 - KyotoEBMT System Description for the 2nd Workshop on...John Richardson - 2015 - KyotoEBMT System Description for the 2nd Workshop on...
John Richardson - 2015 - KyotoEBMT System Description for the 2nd Workshop on...
Association for Computational Linguistics
 
Satoshi Sonoh - 2015 - Toshiba MT System Description for the WAT2015 Workshop
Satoshi Sonoh - 2015 - Toshiba MT System Description for the WAT2015 WorkshopSatoshi Sonoh - 2015 - Toshiba MT System Description for the WAT2015 Workshop
Satoshi Sonoh - 2015 - Toshiba MT System Description for the WAT2015 Workshop
Association for Computational Linguistics
 
Philosophy of Deep Learning
Philosophy of Deep LearningPhilosophy of Deep Learning
Philosophy of Deep Learning
Melanie Swan
 
Cs231n 2017 lecture12 Visualizing and Understanding
Cs231n 2017 lecture12 Visualizing and UnderstandingCs231n 2017 lecture12 Visualizing and Understanding
Cs231n 2017 lecture12 Visualizing and Understanding
Yanbin Kong
 
Using Text Embeddings for Information Retrieval
Using Text Embeddings for Information RetrievalUsing Text Embeddings for Information Retrieval
Using Text Embeddings for Information Retrieval
Bhaskar Mitra
 
Roee Aharoni - 2017 - Towards String-to-Tree Neural Machine Translation
Roee Aharoni - 2017 - Towards String-to-Tree Neural Machine TranslationRoee Aharoni - 2017 - Towards String-to-Tree Neural Machine Translation
Roee Aharoni - 2017 - Towards String-to-Tree Neural Machine Translation
Association for Computational Linguistics
 
Chris Dyer - 2017 - CoNLL Invited Talk: Should Neural Network Architecture Re...
Chris Dyer - 2017 - CoNLL Invited Talk: Should Neural Network Architecture Re...Chris Dyer - 2017 - CoNLL Invited Talk: Should Neural Network Architecture Re...
Chris Dyer - 2017 - CoNLL Invited Talk: Should Neural Network Architecture Re...
Association for Computational Linguistics
 
iPhone5c的最后猜测
iPhone5c的最后猜测iPhone5c的最后猜测
iPhone5c的最后猜测
Yanbin Kong
 
Hackathon 2014 NLP Hack
Hackathon 2014 NLP HackHackathon 2014 NLP Hack
Hackathon 2014 NLP Hack
Roelof Pieters
 
Blockchain Economic Theory
Blockchain Economic TheoryBlockchain Economic Theory
Blockchain Economic Theory
Melanie Swan
 
Cs231n 2017 lecture10 Recurrent Neural Networks
Cs231n 2017 lecture10 Recurrent Neural NetworksCs231n 2017 lecture10 Recurrent Neural Networks
Cs231n 2017 lecture10 Recurrent Neural Networks
Yanbin Kong
 
Deep Learning Explained
Deep Learning ExplainedDeep Learning Explained
Deep Learning Explained
Melanie Swan
 
Venkatesh Duppada - 2017 - SeerNet at EmoInt-2017: Tweet Emotion Intensity Es...
Venkatesh Duppada - 2017 - SeerNet at EmoInt-2017: Tweet Emotion Intensity Es...Venkatesh Duppada - 2017 - SeerNet at EmoInt-2017: Tweet Emotion Intensity Es...
Venkatesh Duppada - 2017 - SeerNet at EmoInt-2017: Tweet Emotion Intensity Es...
Association for Computational Linguistics
 
Neural Models for Document Ranking
Neural Models for Document RankingNeural Models for Document Ranking
Neural Models for Document Ranking
Bhaskar Mitra
 
Satoshi Sonoh - 2015 - Toshiba MT System Description for the WAT2015 Workshop
Satoshi Sonoh - 2015 - Toshiba MT System Description for the WAT2015 WorkshopSatoshi Sonoh - 2015 - Toshiba MT System Description for the WAT2015 Workshop
Satoshi Sonoh - 2015 - Toshiba MT System Description for the WAT2015 Workshop
Association for Computational Linguistics
 
John Richardson - 2015 - KyotoEBMT System Description for the 2nd Workshop on...
John Richardson - 2015 - KyotoEBMT System Description for the 2nd Workshop on...John Richardson - 2015 - KyotoEBMT System Description for the 2nd Workshop on...
John Richardson - 2015 - KyotoEBMT System Description for the 2nd Workshop on...
Association for Computational Linguistics
 
Deep Learning for Chatbot (3/4)
Deep Learning for Chatbot (3/4)Deep Learning for Chatbot (3/4)
Deep Learning for Chatbot (3/4)
Jaemin Cho
 
Zhongyuan Zhu - 2015 - Evaluating Neural Machine Translation in English-Japan...
Zhongyuan Zhu - 2015 - Evaluating Neural Machine Translation in English-Japan...Zhongyuan Zhu - 2015 - Evaluating Neural Machine Translation in English-Japan...
Zhongyuan Zhu - 2015 - Evaluating Neural Machine Translation in English-Japan...
Association for Computational Linguistics
 
John Richardson - 2015 - KyotoEBMT System Description for the 2nd Workshop on...
John Richardson - 2015 - KyotoEBMT System Description for the 2nd Workshop on...John Richardson - 2015 - KyotoEBMT System Description for the 2nd Workshop on...
John Richardson - 2015 - KyotoEBMT System Description for the 2nd Workshop on...
Association for Computational Linguistics
 
Satoshi Sonoh - 2015 - Toshiba MT System Description for the WAT2015 Workshop
Satoshi Sonoh - 2015 - Toshiba MT System Description for the WAT2015 WorkshopSatoshi Sonoh - 2015 - Toshiba MT System Description for the WAT2015 Workshop
Satoshi Sonoh - 2015 - Toshiba MT System Description for the WAT2015 Workshop
Association for Computational Linguistics
 
Philosophy of Deep Learning
Philosophy of Deep LearningPhilosophy of Deep Learning
Philosophy of Deep Learning
Melanie Swan
 
Cs231n 2017 lecture12 Visualizing and Understanding
Cs231n 2017 lecture12 Visualizing and UnderstandingCs231n 2017 lecture12 Visualizing and Understanding
Cs231n 2017 lecture12 Visualizing and Understanding
Yanbin Kong
 
Using Text Embeddings for Information Retrieval
Using Text Embeddings for Information RetrievalUsing Text Embeddings for Information Retrieval
Using Text Embeddings for Information Retrieval
Bhaskar Mitra
 
Chris Dyer - 2017 - CoNLL Invited Talk: Should Neural Network Architecture Re...
Chris Dyer - 2017 - CoNLL Invited Talk: Should Neural Network Architecture Re...Chris Dyer - 2017 - CoNLL Invited Talk: Should Neural Network Architecture Re...
Chris Dyer - 2017 - CoNLL Invited Talk: Should Neural Network Architecture Re...
Association for Computational Linguistics
 
iPhone5c的最后猜测
iPhone5c的最后猜测iPhone5c的最后猜测
iPhone5c的最后猜测
Yanbin Kong
 
Hackathon 2014 NLP Hack
Hackathon 2014 NLP HackHackathon 2014 NLP Hack
Hackathon 2014 NLP Hack
Roelof Pieters
 
Ad

Similar to Advanced Node.JS Meetup (20)

node.js.pptx
node.js.pptxnode.js.pptx
node.js.pptx
rani marri
 
IOC + Javascript
IOC + JavascriptIOC + Javascript
IOC + Javascript
Brian Cavalier
 
Es build presentation
Es build presentationEs build presentation
Es build presentation
PT Citra Niaga Teknologi
 
JavaScript Modules Done Right
JavaScript Modules Done RightJavaScript Modules Done Right
JavaScript Modules Done Right
Mariusz Nowak
 
Angular JS in 2017
Angular JS in 2017Angular JS in 2017
Angular JS in 2017
Ayush Sharma
 
Modules and EmbedJS
Modules and EmbedJSModules and EmbedJS
Modules and EmbedJS
Jens Arps
 
JavaScript Module Loaders
JavaScript Module LoadersJavaScript Module Loaders
JavaScript Module Loaders
zeroproductionincidents
 
JavaScript Miller Columns
JavaScript Miller ColumnsJavaScript Miller Columns
JavaScript Miller Columns
Jonathan Fine
 
NodeJs Session02
NodeJs Session02NodeJs Session02
NodeJs Session02
Jainul Musani
 
Nodejs
NodejsNodejs
Nodejs
Vinod Kumar Marupu
 
Workshop 2: JavaScript Design Patterns
Workshop 2: JavaScript Design PatternsWorkshop 2: JavaScript Design Patterns
Workshop 2: JavaScript Design Patterns
Visual Engineering
 
uRequire@greecejs: An introduction to http://uRequire.org
uRequire@greecejs: An introduction to http://uRequire.orguRequire@greecejs: An introduction to http://uRequire.org
uRequire@greecejs: An introduction to http://uRequire.org
Agelos Pikoulas
 
Node JS Interview Question PDF By ScholarHat
Node JS Interview Question PDF By ScholarHatNode JS Interview Question PDF By ScholarHat
Node JS Interview Question PDF By ScholarHat
Scholarhat
 
distage: Purely Functional Staged Dependency Injection; bonus: Faking Kind Po...
distage: Purely Functional Staged Dependency Injection; bonus: Faking Kind Po...distage: Purely Functional Staged Dependency Injection; bonus: Faking Kind Po...
distage: Purely Functional Staged Dependency Injection; bonus: Faking Kind Po...
7mind
 
Readme
ReadmeReadme
Readme
rec2006
 
Full Stack React Workshop [CSSC x GDSC]
Full Stack React Workshop [CSSC x GDSC]Full Stack React Workshop [CSSC x GDSC]
Full Stack React Workshop [CSSC x GDSC]
GDSC UofT Mississauga
 
Introduction to Node.js
Introduction to Node.jsIntroduction to Node.js
Introduction to Node.js
Vikash Singh
 
Global objects in Node.pdf
Global objects in Node.pdfGlobal objects in Node.pdf
Global objects in Node.pdf
SudhanshiBakre1
 
Introduction to node.js GDD
Introduction to node.js GDDIntroduction to node.js GDD
Introduction to node.js GDD
Sudar Muthu
 
Intro to Node.js
Intro to Node.jsIntro to Node.js
Intro to Node.js
James Carr
 
JavaScript Modules Done Right
JavaScript Modules Done RightJavaScript Modules Done Right
JavaScript Modules Done Right
Mariusz Nowak
 
Angular JS in 2017
Angular JS in 2017Angular JS in 2017
Angular JS in 2017
Ayush Sharma
 
Modules and EmbedJS
Modules and EmbedJSModules and EmbedJS
Modules and EmbedJS
Jens Arps
 
JavaScript Miller Columns
JavaScript Miller ColumnsJavaScript Miller Columns
JavaScript Miller Columns
Jonathan Fine
 
Workshop 2: JavaScript Design Patterns
Workshop 2: JavaScript Design PatternsWorkshop 2: JavaScript Design Patterns
Workshop 2: JavaScript Design Patterns
Visual Engineering
 
uRequire@greecejs: An introduction to http://uRequire.org
uRequire@greecejs: An introduction to http://uRequire.orguRequire@greecejs: An introduction to http://uRequire.org
uRequire@greecejs: An introduction to http://uRequire.org
Agelos Pikoulas
 
Node JS Interview Question PDF By ScholarHat
Node JS Interview Question PDF By ScholarHatNode JS Interview Question PDF By ScholarHat
Node JS Interview Question PDF By ScholarHat
Scholarhat
 
distage: Purely Functional Staged Dependency Injection; bonus: Faking Kind Po...
distage: Purely Functional Staged Dependency Injection; bonus: Faking Kind Po...distage: Purely Functional Staged Dependency Injection; bonus: Faking Kind Po...
distage: Purely Functional Staged Dependency Injection; bonus: Faking Kind Po...
7mind
 
Full Stack React Workshop [CSSC x GDSC]
Full Stack React Workshop [CSSC x GDSC]Full Stack React Workshop [CSSC x GDSC]
Full Stack React Workshop [CSSC x GDSC]
GDSC UofT Mississauga
 
Introduction to Node.js
Introduction to Node.jsIntroduction to Node.js
Introduction to Node.js
Vikash Singh
 
Global objects in Node.pdf
Global objects in Node.pdfGlobal objects in Node.pdf
Global objects in Node.pdf
SudhanshiBakre1
 
Introduction to node.js GDD
Introduction to node.js GDDIntroduction to node.js GDD
Introduction to node.js GDD
Sudar Muthu
 
Intro to Node.js
Intro to Node.jsIntro to Node.js
Intro to Node.js
James Carr
 
Ad

More from LINAGORA (20)

Personal branding : e-recrutement et réseaux sociaux professionnels
Personal branding : e-recrutement et réseaux sociaux professionnels Personal branding : e-recrutement et réseaux sociaux professionnels
Personal branding : e-recrutement et réseaux sociaux professionnels
LINAGORA
 
Construisons ensemble le chatbot bancaire dedemain !
Construisons ensemble le chatbot bancaire dedemain !Construisons ensemble le chatbot bancaire dedemain !
Construisons ensemble le chatbot bancaire dedemain !
LINAGORA
 
ChatBots et intelligence artificielle arrivent dans les banques
ChatBots et intelligence artificielle arrivent dans les banques ChatBots et intelligence artificielle arrivent dans les banques
ChatBots et intelligence artificielle arrivent dans les banques
LINAGORA
 
Deep Learning in practice : Speech recognition and beyond - Meetup
Deep Learning in practice : Speech recognition and beyond - MeetupDeep Learning in practice : Speech recognition and beyond - Meetup
Deep Learning in practice : Speech recognition and beyond - Meetup
LINAGORA
 
Call a C API from Python becomes more enjoyable with CFFI
Call a C API from Python becomes more enjoyable with CFFICall a C API from Python becomes more enjoyable with CFFI
Call a C API from Python becomes more enjoyable with CFFI
LINAGORA
 
[UDS] Cloud Computing "pour les nuls" (Exemple avec LinShare)
[UDS] Cloud Computing "pour les nuls" (Exemple avec LinShare)[UDS] Cloud Computing "pour les nuls" (Exemple avec LinShare)
[UDS] Cloud Computing "pour les nuls" (Exemple avec LinShare)
LINAGORA
 
Angular v2 et plus : le futur du développement d'applications en entreprise
Angular v2 et plus : le futur du développement d'applications en entrepriseAngular v2 et plus : le futur du développement d'applications en entreprise
Angular v2 et plus : le futur du développement d'applications en entreprise
LINAGORA
 
Comment faire ses mappings ElasticSearch aux petits oignons ? - LINAGORA
Comment faire ses mappings ElasticSearch aux petits oignons ? - LINAGORAComment faire ses mappings ElasticSearch aux petits oignons ? - LINAGORA
Comment faire ses mappings ElasticSearch aux petits oignons ? - LINAGORA
LINAGORA
 
Angular (v2 and up) - Morning to understand - Linagora
Angular (v2 and up) - Morning to understand - LinagoraAngular (v2 and up) - Morning to understand - Linagora
Angular (v2 and up) - Morning to understand - Linagora
LINAGORA
 
Industrialisez le développement et la maintenance de vos sites avec Drupal
Industrialisez le développement et la maintenance de vos sites avec DrupalIndustrialisez le développement et la maintenance de vos sites avec Drupal
Industrialisez le développement et la maintenance de vos sites avec Drupal
LINAGORA
 
CapDémat Evolution plateforme de GRU pour collectivités
CapDémat Evolution plateforme de GRU pour collectivitésCapDémat Evolution plateforme de GRU pour collectivités
CapDémat Evolution plateforme de GRU pour collectivités
LINAGORA
 
Présentation du marché P2I UGAP « Support sur Logiciels Libres »
Présentation du marché P2I UGAP « Support sur Logiciels Libres »Présentation du marché P2I UGAP « Support sur Logiciels Libres »
Présentation du marché P2I UGAP « Support sur Logiciels Libres »
LINAGORA
 
Offre de demat d'Adullact projet
Offre de demat d'Adullact projet Offre de demat d'Adullact projet
Offre de demat d'Adullact projet
LINAGORA
 
La dématérialisation du conseil minicipal
La dématérialisation du conseil minicipalLa dématérialisation du conseil minicipal
La dématérialisation du conseil minicipal
LINAGORA
 
Open stack @ sierra wireless
Open stack @ sierra wirelessOpen stack @ sierra wireless
Open stack @ sierra wireless
LINAGORA
 
OpenStack - open source au service du Cloud
OpenStack - open source au service du CloudOpenStack - open source au service du Cloud
OpenStack - open source au service du Cloud
LINAGORA
 
Architecture d'annuaire hautement disponible avec OpenLDAP
Architecture d'annuaire hautement disponible avec OpenLDAPArchitecture d'annuaire hautement disponible avec OpenLDAP
Architecture d'annuaire hautement disponible avec OpenLDAP
LINAGORA
 
Présentation offre LINID
Présentation offre LINIDPrésentation offre LINID
Présentation offre LINID
LINAGORA
 
Matinée pour conmrendre consacrée à LinID.org, gestion, fédération et contrôl...
Matinée pour conmrendre consacrée à LinID.org, gestion, fédération et contrôl...Matinée pour conmrendre consacrée à LinID.org, gestion, fédération et contrôl...
Matinée pour conmrendre consacrée à LinID.org, gestion, fédération et contrôl...
LINAGORA
 
Matinée pour conmrendre consacrée à LinShare.org, application de partage de f...
Matinée pour conmrendre consacrée à LinShare.org, application de partage de f...Matinée pour conmrendre consacrée à LinShare.org, application de partage de f...
Matinée pour conmrendre consacrée à LinShare.org, application de partage de f...
LINAGORA
 
Personal branding : e-recrutement et réseaux sociaux professionnels
Personal branding : e-recrutement et réseaux sociaux professionnels Personal branding : e-recrutement et réseaux sociaux professionnels
Personal branding : e-recrutement et réseaux sociaux professionnels
LINAGORA
 
Construisons ensemble le chatbot bancaire dedemain !
Construisons ensemble le chatbot bancaire dedemain !Construisons ensemble le chatbot bancaire dedemain !
Construisons ensemble le chatbot bancaire dedemain !
LINAGORA
 
ChatBots et intelligence artificielle arrivent dans les banques
ChatBots et intelligence artificielle arrivent dans les banques ChatBots et intelligence artificielle arrivent dans les banques
ChatBots et intelligence artificielle arrivent dans les banques
LINAGORA
 
Deep Learning in practice : Speech recognition and beyond - Meetup
Deep Learning in practice : Speech recognition and beyond - MeetupDeep Learning in practice : Speech recognition and beyond - Meetup
Deep Learning in practice : Speech recognition and beyond - Meetup
LINAGORA
 
Call a C API from Python becomes more enjoyable with CFFI
Call a C API from Python becomes more enjoyable with CFFICall a C API from Python becomes more enjoyable with CFFI
Call a C API from Python becomes more enjoyable with CFFI
LINAGORA
 
[UDS] Cloud Computing "pour les nuls" (Exemple avec LinShare)
[UDS] Cloud Computing "pour les nuls" (Exemple avec LinShare)[UDS] Cloud Computing "pour les nuls" (Exemple avec LinShare)
[UDS] Cloud Computing "pour les nuls" (Exemple avec LinShare)
LINAGORA
 
Angular v2 et plus : le futur du développement d'applications en entreprise
Angular v2 et plus : le futur du développement d'applications en entrepriseAngular v2 et plus : le futur du développement d'applications en entreprise
Angular v2 et plus : le futur du développement d'applications en entreprise
LINAGORA
 
Comment faire ses mappings ElasticSearch aux petits oignons ? - LINAGORA
Comment faire ses mappings ElasticSearch aux petits oignons ? - LINAGORAComment faire ses mappings ElasticSearch aux petits oignons ? - LINAGORA
Comment faire ses mappings ElasticSearch aux petits oignons ? - LINAGORA
LINAGORA
 
Angular (v2 and up) - Morning to understand - Linagora
Angular (v2 and up) - Morning to understand - LinagoraAngular (v2 and up) - Morning to understand - Linagora
Angular (v2 and up) - Morning to understand - Linagora
LINAGORA
 
Industrialisez le développement et la maintenance de vos sites avec Drupal
Industrialisez le développement et la maintenance de vos sites avec DrupalIndustrialisez le développement et la maintenance de vos sites avec Drupal
Industrialisez le développement et la maintenance de vos sites avec Drupal
LINAGORA
 
CapDémat Evolution plateforme de GRU pour collectivités
CapDémat Evolution plateforme de GRU pour collectivitésCapDémat Evolution plateforme de GRU pour collectivités
CapDémat Evolution plateforme de GRU pour collectivités
LINAGORA
 
Présentation du marché P2I UGAP « Support sur Logiciels Libres »
Présentation du marché P2I UGAP « Support sur Logiciels Libres »Présentation du marché P2I UGAP « Support sur Logiciels Libres »
Présentation du marché P2I UGAP « Support sur Logiciels Libres »
LINAGORA
 
Offre de demat d'Adullact projet
Offre de demat d'Adullact projet Offre de demat d'Adullact projet
Offre de demat d'Adullact projet
LINAGORA
 
La dématérialisation du conseil minicipal
La dématérialisation du conseil minicipalLa dématérialisation du conseil minicipal
La dématérialisation du conseil minicipal
LINAGORA
 
Open stack @ sierra wireless
Open stack @ sierra wirelessOpen stack @ sierra wireless
Open stack @ sierra wireless
LINAGORA
 
OpenStack - open source au service du Cloud
OpenStack - open source au service du CloudOpenStack - open source au service du Cloud
OpenStack - open source au service du Cloud
LINAGORA
 
Architecture d'annuaire hautement disponible avec OpenLDAP
Architecture d'annuaire hautement disponible avec OpenLDAPArchitecture d'annuaire hautement disponible avec OpenLDAP
Architecture d'annuaire hautement disponible avec OpenLDAP
LINAGORA
 
Présentation offre LINID
Présentation offre LINIDPrésentation offre LINID
Présentation offre LINID
LINAGORA
 
Matinée pour conmrendre consacrée à LinID.org, gestion, fédération et contrôl...
Matinée pour conmrendre consacrée à LinID.org, gestion, fédération et contrôl...Matinée pour conmrendre consacrée à LinID.org, gestion, fédération et contrôl...
Matinée pour conmrendre consacrée à LinID.org, gestion, fédération et contrôl...
LINAGORA
 
Matinée pour conmrendre consacrée à LinShare.org, application de partage de f...
Matinée pour conmrendre consacrée à LinShare.org, application de partage de f...Matinée pour conmrendre consacrée à LinShare.org, application de partage de f...
Matinée pour conmrendre consacrée à LinShare.org, application de partage de f...
LINAGORA
 

Recently uploaded (20)

UiPath Community Berlin: Orchestrator API, Swagger, and Test Manager API
UiPath Community Berlin: Orchestrator API, Swagger, and Test Manager APIUiPath Community Berlin: Orchestrator API, Swagger, and Test Manager API
UiPath Community Berlin: Orchestrator API, Swagger, and Test Manager API
UiPathCommunity
 
Enhancing ICU Intelligence: How Our Functional Testing Enabled a Healthcare I...
Enhancing ICU Intelligence: How Our Functional Testing Enabled a Healthcare I...Enhancing ICU Intelligence: How Our Functional Testing Enabled a Healthcare I...
Enhancing ICU Intelligence: How Our Functional Testing Enabled a Healthcare I...
Impelsys Inc.
 
How analogue intelligence complements AI
How analogue intelligence complements AIHow analogue intelligence complements AI
How analogue intelligence complements AI
Paul Rowe
 
AI and Data Privacy in 2025: Global Trends
AI and Data Privacy in 2025: Global TrendsAI and Data Privacy in 2025: Global Trends
AI and Data Privacy in 2025: Global Trends
InData Labs
 
Drupalcamp Finland – Measuring Front-end Energy Consumption
Drupalcamp Finland – Measuring Front-end Energy ConsumptionDrupalcamp Finland – Measuring Front-end Energy Consumption
Drupalcamp Finland – Measuring Front-end Energy Consumption
Exove
 
IEDM 2024 Tutorial2_Advances in CMOS Technologies and Future Directions for C...
IEDM 2024 Tutorial2_Advances in CMOS Technologies and Future Directions for C...IEDM 2024 Tutorial2_Advances in CMOS Technologies and Future Directions for C...
IEDM 2024 Tutorial2_Advances in CMOS Technologies and Future Directions for C...
organizerofv
 
tecnologias de las primeras civilizaciones.pdf
tecnologias de las primeras civilizaciones.pdftecnologias de las primeras civilizaciones.pdf
tecnologias de las primeras civilizaciones.pdf
fjgm517
 
Cybersecurity Identity and Access Solutions using Azure AD
Cybersecurity Identity and Access Solutions using Azure ADCybersecurity Identity and Access Solutions using Azure AD
Cybersecurity Identity and Access Solutions using Azure AD
VICTOR MAESTRE RAMIREZ
 
Technology Trends in 2025: AI and Big Data Analytics
Technology Trends in 2025: AI and Big Data AnalyticsTechnology Trends in 2025: AI and Big Data Analytics
Technology Trends in 2025: AI and Big Data Analytics
InData Labs
 
HCL Nomad Web – Best Practices und Verwaltung von Multiuser-Umgebungen
HCL Nomad Web – Best Practices und Verwaltung von Multiuser-UmgebungenHCL Nomad Web – Best Practices und Verwaltung von Multiuser-Umgebungen
HCL Nomad Web – Best Practices und Verwaltung von Multiuser-Umgebungen
panagenda
 
Heap, Types of Heap, Insertion and Deletion
Heap, Types of Heap, Insertion and DeletionHeap, Types of Heap, Insertion and Deletion
Heap, Types of Heap, Insertion and Deletion
Jaydeep Kale
 
Quantum Computing Quick Research Guide by Arthur Morgan
Quantum Computing Quick Research Guide by Arthur MorganQuantum Computing Quick Research Guide by Arthur Morgan
Quantum Computing Quick Research Guide by Arthur Morgan
Arthur Morgan
 
Transcript: #StandardsGoals for 2025: Standards & certification roundup - Tec...
Transcript: #StandardsGoals for 2025: Standards & certification roundup - Tec...Transcript: #StandardsGoals for 2025: Standards & certification roundup - Tec...
Transcript: #StandardsGoals for 2025: Standards & certification roundup - Tec...
BookNet Canada
 
Semantic Cultivators : The Critical Future Role to Enable AI
Semantic Cultivators : The Critical Future Role to Enable AISemantic Cultivators : The Critical Future Role to Enable AI
Semantic Cultivators : The Critical Future Role to Enable AI
artmondano
 
Big Data Analytics Quick Research Guide by Arthur Morgan
Big Data Analytics Quick Research Guide by Arthur MorganBig Data Analytics Quick Research Guide by Arthur Morgan
Big Data Analytics Quick Research Guide by Arthur Morgan
Arthur Morgan
 
Greenhouse_Monitoring_Presentation.pptx.
Greenhouse_Monitoring_Presentation.pptx.Greenhouse_Monitoring_Presentation.pptx.
Greenhouse_Monitoring_Presentation.pptx.
hpbmnnxrvb
 
Massive Power Outage Hits Spain, Portugal, and France: Causes, Impact, and On...
Massive Power Outage Hits Spain, Portugal, and France: Causes, Impact, and On...Massive Power Outage Hits Spain, Portugal, and France: Causes, Impact, and On...
Massive Power Outage Hits Spain, Portugal, and France: Causes, Impact, and On...
Aqusag Technologies
 
Linux Professional Institute LPIC-1 Exam.pdf
Linux Professional Institute LPIC-1 Exam.pdfLinux Professional Institute LPIC-1 Exam.pdf
Linux Professional Institute LPIC-1 Exam.pdf
RHCSA Guru
 
How Can I use the AI Hype in my Business Context?
How Can I use the AI Hype in my Business Context?How Can I use the AI Hype in my Business Context?
How Can I use the AI Hype in my Business Context?
Daniel Lehner
 
Generative Artificial Intelligence (GenAI) in Business
Generative Artificial Intelligence (GenAI) in BusinessGenerative Artificial Intelligence (GenAI) in Business
Generative Artificial Intelligence (GenAI) in Business
Dr. Tathagat Varma
 
UiPath Community Berlin: Orchestrator API, Swagger, and Test Manager API
UiPath Community Berlin: Orchestrator API, Swagger, and Test Manager APIUiPath Community Berlin: Orchestrator API, Swagger, and Test Manager API
UiPath Community Berlin: Orchestrator API, Swagger, and Test Manager API
UiPathCommunity
 
Enhancing ICU Intelligence: How Our Functional Testing Enabled a Healthcare I...
Enhancing ICU Intelligence: How Our Functional Testing Enabled a Healthcare I...Enhancing ICU Intelligence: How Our Functional Testing Enabled a Healthcare I...
Enhancing ICU Intelligence: How Our Functional Testing Enabled a Healthcare I...
Impelsys Inc.
 
How analogue intelligence complements AI
How analogue intelligence complements AIHow analogue intelligence complements AI
How analogue intelligence complements AI
Paul Rowe
 
AI and Data Privacy in 2025: Global Trends
AI and Data Privacy in 2025: Global TrendsAI and Data Privacy in 2025: Global Trends
AI and Data Privacy in 2025: Global Trends
InData Labs
 
Drupalcamp Finland – Measuring Front-end Energy Consumption
Drupalcamp Finland – Measuring Front-end Energy ConsumptionDrupalcamp Finland – Measuring Front-end Energy Consumption
Drupalcamp Finland – Measuring Front-end Energy Consumption
Exove
 
IEDM 2024 Tutorial2_Advances in CMOS Technologies and Future Directions for C...
IEDM 2024 Tutorial2_Advances in CMOS Technologies and Future Directions for C...IEDM 2024 Tutorial2_Advances in CMOS Technologies and Future Directions for C...
IEDM 2024 Tutorial2_Advances in CMOS Technologies and Future Directions for C...
organizerofv
 
tecnologias de las primeras civilizaciones.pdf
tecnologias de las primeras civilizaciones.pdftecnologias de las primeras civilizaciones.pdf
tecnologias de las primeras civilizaciones.pdf
fjgm517
 
Cybersecurity Identity and Access Solutions using Azure AD
Cybersecurity Identity and Access Solutions using Azure ADCybersecurity Identity and Access Solutions using Azure AD
Cybersecurity Identity and Access Solutions using Azure AD
VICTOR MAESTRE RAMIREZ
 
Technology Trends in 2025: AI and Big Data Analytics
Technology Trends in 2025: AI and Big Data AnalyticsTechnology Trends in 2025: AI and Big Data Analytics
Technology Trends in 2025: AI and Big Data Analytics
InData Labs
 
HCL Nomad Web – Best Practices und Verwaltung von Multiuser-Umgebungen
HCL Nomad Web – Best Practices und Verwaltung von Multiuser-UmgebungenHCL Nomad Web – Best Practices und Verwaltung von Multiuser-Umgebungen
HCL Nomad Web – Best Practices und Verwaltung von Multiuser-Umgebungen
panagenda
 
Heap, Types of Heap, Insertion and Deletion
Heap, Types of Heap, Insertion and DeletionHeap, Types of Heap, Insertion and Deletion
Heap, Types of Heap, Insertion and Deletion
Jaydeep Kale
 
Quantum Computing Quick Research Guide by Arthur Morgan
Quantum Computing Quick Research Guide by Arthur MorganQuantum Computing Quick Research Guide by Arthur Morgan
Quantum Computing Quick Research Guide by Arthur Morgan
Arthur Morgan
 
Transcript: #StandardsGoals for 2025: Standards & certification roundup - Tec...
Transcript: #StandardsGoals for 2025: Standards & certification roundup - Tec...Transcript: #StandardsGoals for 2025: Standards & certification roundup - Tec...
Transcript: #StandardsGoals for 2025: Standards & certification roundup - Tec...
BookNet Canada
 
Semantic Cultivators : The Critical Future Role to Enable AI
Semantic Cultivators : The Critical Future Role to Enable AISemantic Cultivators : The Critical Future Role to Enable AI
Semantic Cultivators : The Critical Future Role to Enable AI
artmondano
 
Big Data Analytics Quick Research Guide by Arthur Morgan
Big Data Analytics Quick Research Guide by Arthur MorganBig Data Analytics Quick Research Guide by Arthur Morgan
Big Data Analytics Quick Research Guide by Arthur Morgan
Arthur Morgan
 
Greenhouse_Monitoring_Presentation.pptx.
Greenhouse_Monitoring_Presentation.pptx.Greenhouse_Monitoring_Presentation.pptx.
Greenhouse_Monitoring_Presentation.pptx.
hpbmnnxrvb
 
Massive Power Outage Hits Spain, Portugal, and France: Causes, Impact, and On...
Massive Power Outage Hits Spain, Portugal, and France: Causes, Impact, and On...Massive Power Outage Hits Spain, Portugal, and France: Causes, Impact, and On...
Massive Power Outage Hits Spain, Portugal, and France: Causes, Impact, and On...
Aqusag Technologies
 
Linux Professional Institute LPIC-1 Exam.pdf
Linux Professional Institute LPIC-1 Exam.pdfLinux Professional Institute LPIC-1 Exam.pdf
Linux Professional Institute LPIC-1 Exam.pdf
RHCSA Guru
 
How Can I use the AI Hype in my Business Context?
How Can I use the AI Hype in my Business Context?How Can I use the AI Hype in my Business Context?
How Can I use the AI Hype in my Business Context?
Daniel Lehner
 
Generative Artificial Intelligence (GenAI) in Business
Generative Artificial Intelligence (GenAI) in BusinessGenerative Artificial Intelligence (GenAI) in Business
Generative Artificial Intelligence (GenAI) in Business
Dr. Tathagat Varma
 

Advanced Node.JS Meetup

  • 2. The French Leader in Open Source Software
  • 3. French leader in Open Source Software
  • 4. An alternative to proprietary software
  • 7. Node's Architecture: V8 ● The two most important players in Node's architecture are V8 and libuv. Node's default VM is, and will continue to be, V8, although V8 is one option out of many ● One other strong option for a Node's VM is the Chakra engine by Microsoft. The Chakra engine is what powers the Microsoft Edge web browser ● JavaScript features that are available in Node are really the JavaScript features supported by the V8 engine shipped with Node
  • 8. Node's Architecture: V8 ● When Node has a callback to invoke, it simply passes the control into the V8 engine. When V8 is done with the code in the callback, the control is passed back to Node. ● V8 is single-threaded, Node cannot execute several JavaScript code, no matter how many callbacks have been registered ● Node will wait until V8 can handle more operations.
  • 10. Node's Architecture: libuv ● Node is more than a wrapper for V8, it provides APIs for working with operating system files, binary data, networking and much more. ● Node also handles the waiting for asynchronous events for us using libuv. ● Libuv is a C library developed for Node. ● It's used to abstract the non-blocking I/O operations to a consistent interface across many operating systems. ● Libuv is also what provides Node with the event-loop
  • 12. Concurrency Model and Event Loop
  • 13. I/O ● Slow I/O operations are handled with events and callbacks so that they don't block the main single-threaded execution runtime. ● I/O is used to label a communication between a process in a computer CPU and anything external to that CPU, including memory, disk, network, and even another process.
  • 15. The Call Stack ● The V8 Call stack which is simply a list of functions. ● FILO data structure ○ const f1 = () => { f2(); }; ○ const f2 = () => { f3(); }; ○ const f3 = () => { f4(); }; ○ const f4 = () => { f4(); }; ● When start dealing with slow operations, the fact that we have a single thread becomes a problem, because these slow operations will block the execution.
  • 16. The Call Stack const add = (a, b) => a + b; const double = a => add(a, a); const printDouble = a => { const output = double(a); console.log(output); }; printDouble(9); printDouble(9) double(9) add(9, 9) console.log(18)
  • 17. The Call Stack const slowAdd = (a, b) => { for(let i=0; i<999999999; i++) {}; return a + b; }; const a = slowAdd(3, 3); const b = slowAdd(4, 4); console.log(a); console.log(b); slowAdd(3, 3)slowAdd(4, 4)console.log(6)console.log(8)
  • 18. How Callbacks Actually Work const slowAdd = (a, b) => { setTimeout(() => { console.log(a+b); }, 5000); }; slowAdd(3, 3); slowAdd(4, 4); slowAdd(3, 3) setTimeout() slowAdd(4, 4) setTimeout() console.log(6)console.log(8)
  • 20. How Callbacks Actually Work const slowAdd = (a, b) => { setTimeout(() => { console.log(a+b); }, 5000); }; slowAdd(3, 3); slowAdd(4, 4); slowAdd(3, 3) setTimeout() slowAdd(4, 4) setTimeout() Call stack Node Timer cb1 Timer cb2
  • 21. How Callbacks Actually Work const slowAdd = (a, b) => { setTimeout(() => { console.log(a+b); }, 5000); }; slowAdd(3, 3); slowAdd(4, 4); console.log(6)console.log(8) Call stack Node Queue Timer cb1 Timer cb2 cb1 cb2
  • 22. The Event loop ● Both the Stack and the Heap are part of the run-time engine V8, not Node itself. ● Node adds APIs like timers, emitters, and wrappers around OS operations. It also provides the event Queue and the event loop using the libuv library. ● Event loop = a simple loop that works between the event queue and the call stack.
  • 23. YOLO
  • 25. Look familiar? module bundlers vs. module loaders Webpack vs. Browserify AMD vs. CommonJS
  • 26. Explain what modules plz Good authors divide their books into chapters and sections Good programmers divide their programs into modules.
  • 27. Module pattern Module pattern is used to mimic the concept of classes, so that we can store both public and private methods and variables inside a single object  There are several ways to accomplish the module pattern Anonymous closure: our anonymous function has its own evaluation environment or “closure”, and then we immediately evaluate it. This lets us hide variables from the parent (global) namespace. (function () { // We keep these variables private inside this closure scope var myGrades = [93, 95, 88, 0, 55, 91]; var average = function() { var total = myGrades.reduce(function(accumulator, item) { return accumulator + item}, 0); return 'Your average grade is ' + total / myGrades.length + '.'; } var failing = function(){ var failingGrades = myGrades.filter(function(item) { return item < 70;}); return 'You failed ' + failingGrades.length + ' times.'; } console.log(failing()); }()); // ‘You failed 2 times.’
  • 28. Have a look again Remember: in JavaScript, functions are the only way to create new scope. Note that the parenthesis around the anonymous function are required, because statements that begin with the keyword function are always considered to be function declarations Remember, you can’t have unnamed function declarations in JavaScript The surrounding parentheses create a function expression instead. (function () { // We keep these variables private inside this closure scope var myGrades = [93, 95, 88, 0, 55, 91]; var average = function() { var total = myGrades.reduce(function(accumulator, item) { return accumulator + item}, 0); return 'Your average grade is ' + total / myGrades.length + '.'; } var failing = function(){ var failingGrades = myGrades.filter(function(item) { return item < 70;}); return 'You failed ' + failingGrades.length + ' times.'; } console.log(failing()); }()); // ‘You failed 2 times.’
  • 29. Why do I need a module pattern As a developer, you need to know the right dependency order to load your files in. For instance, let’s say you’re using Backbone in your project, so you include the script tag for Backbone’s source code in your file. However, since Backbone has a hard dependency on Underscore.js, the script tag for the Backbone file can’t be placed before the Underscore.js file. As a developer, managing dependencies and getting these things right can sometimes be a headache.
  • 30. Why do I need a module pattern Namespace collisions: For example, ● what if two of your modules have the same name? ● Or what if you have two versions of a module, and you need both?
  • 31. CommonJS A CommonJS module is essentially a reusable piece of JavaScript which exports specific objects, making them available for other modules to require in their programs. If you’ve programmed in Node.js, you’ll be very familiar with this format. In CommonJS, we use the module.exports object to expose modules, and require to import them.
  • 32. What to notice CommonJS takes a server-first approach and synchronously loads modules. This matters because if we have three other modules we need to require, it’ll load them one by one. Now, that works great on the server but, unfortunately, makes it harder to use when writing JavaScript for the browser.
  • 33. AMD CommonJS is all well and good, but what if we want to load modules asynchronously? The answer is called Asynchronous Module Definition (AMD) define(['myModule', 'myOtherModule'], function(myModule, myOtherModule) { console.log(myModule.hello()); }); Define function takes an array of each of the module’s dependencies. These dependencies are loaded in the background (in a non-blocking manner), and once loaded define calls the callback function it was given.
  • 34. What to notice Unlike CommonJS, AMD takes a browser-first approach alongside asynchronous behavior to get the job done. Another benefit of AMD is that your modules can be objects, functions, constructors, strings, JSON and many other types, while CommonJS only supports objects as modules. That being said, AMD isn’t compatible with io, filesystem, and other server-oriented features available via CommonJS
  • 35. UMD For projects that require you to support both AMD and CommonJS features, there’s yet another format: Universal Module Definition (UMD). UMD essentially creates a way to use either of the two, while also supporting the global variable definition. UMD modules are capable of working on both client and server.
  • 36. Back to NodeJS Back to CommonJS
  • 37. require(‘something’) Node uses two core modules for managing module dependencies: ● require ● module How do I access them: ● Are they global? ● no need to require('require') ● no need to require('module')
  • 38. Resolving: To find the absolute path of the file. Loading: To determine the type of the file content. Wrapping: To give the file its private scope. This is what makes both the require and module objects local to every file we require. Evaluating: This is what the VM eventually does with the loaded code. Caching: So that when we require this file again, we don’t go over all the steps another time.
  • 39. Resolving a local path Every module object gets an id property to identify it. This id is usually the full path to the file, but in a REPL session it’s simply <repl>. Node modules have a one-to-one relation with files on the file-system. We require a module by loading the content of a file into memory. ~/learn-node $ node > module Module { id: '<repl>', exports: {}, parent: undefined, filename: null, loaded: false, children: [], paths: [ ... ] }
  • 40. require('find-me'); Node will look for find-me.js in all the paths specified by module.paths The paths list is basically a list of node_modules directories under every directory from the current directory to the root directory. If Node can’t find find-me.js in any of these paths, it will throw a “cannot find module error.” ~/learn-node $ node > module.paths [ '/Users/kader/learn-node/repl/node_modules', '/Users/kader/learn-node/node_modules', '/Users/kader/node_modules', '/Users/node_modules', '/node_modules', '/Users/kader/.node_modules', '/Users/kader/.node_libraries']
  • 41. require.resolve If you want to only resolve the module and not execute it, you can use the require.resolve function This behaves exactly the same as the main require function, but does not load the file. > require.resolve('find-me'); '/Users/kader/learn-node/node_modules/find-me/start.js' > require.resolve('not-there'); Error: Cannot find module 'not-there' at Function.Module._resolveFilename (module.js:470:15) at Function.resolve (internal/module.js:27:19) at repl:1:9 at ContextifyScript.Script.runInThisContext (vm.js:23:33) at REPLServer.defaultEval (repl.js:336:29) at bound (domain.js:280:14) at REPLServer.runBound [as eval] (domain.js:293:12) at REPLServer.onLine (repl.js:533:10) at emitOne (events.js:101:20) at REPLServer.emit (events.js:191:7)
  • 42. Parent-child relation between files // learn-node/lib/util.js console.log('In util', module); //learn-node/index.js console.log('In index', module); require('./lib/util');" ~/learn-node $ node index.js In index Module { id: '.', exports: {}, parent: null, filename: '/Users/kader/learn-node/index.js', loaded: false, children: [], paths: [ ... ] } In util Module { id: '/Users/kader/learn-node/lib/util.js', exports: {}, parent: Module { id: '.', exports: {}, parent: null, filename: '/Users/kader/learn-node/index.js', loaded: false, children: [ [Circular] ], paths: [...] }, filename: '/Users/kader/learn-node/lib/util.js', loaded: false, children: [], paths: [...] }
  • 43. Parent-child relation Main index module (id: '.') is now listed as the parent for the lib/util module. However, the lib/util module was not listed as a child of the index module. Instead, we have the [Circular] value there because this is a circular reference. !infinite loop ~/learn-node $ node index.js In index Module { id: '.', exports: {}, parent: null, filename: '/Users/kader/learn-node/index.js', loaded: false, children: [], paths: [ ... ] } In util Module { id: '/Users/kader/learn-node/lib/util.js', exports: {}, parent: Module { id: '.', exports: {}, parent: null, filename: '/Users/kader/learn-node/index.js', loaded: false, children: [ [Circular] ], paths: [...] }, filename: '/Users/kader/learn-node/lib/util.js', loaded: false, children: [], paths: [...] }
  • 44. exports, module.exports Notice the exports property So let us try this: // Add this to lib/util.js exports.id = 'lib/util'; // Add this to index.js exports.id = 'index'; ~/learn-node $ node index.js In index Module { id: '.', exports: {}, parent: null, filename: '/Users/kader/learn-node/index.js', loaded: false, children: [], paths: [ ... ] } In util Module { id: '/Users/kader/learn-node/lib/util.js', exports: {}, parent: Module { id: '.', exports: {}, parent: null, filename: '/Users/kader/learn-node/index.js', loaded: false, children: [ [Circular] ], paths: [...] }, filename: '/Users/kader/learn-node/lib/util.js', loaded: false, children: [], paths: [...] } ~/learn-node $ node index.js In index Module { id: '.', exports: { id: 'index' }, parent: null, filename: '/Users/kader/learn-node/index.js', loaded: false, children: [], paths: [ ... ] } In util Module { id: '/Users/kader/learn-node/lib/util.js', exports: { id: 'lib/util' }, parent: Module { id: '.', exports: { id: 'index' } parent: null, filename: '/Users/kader/learn-node/index.js', loaded: false, children: [ [Circular] ], paths: [...] }, filename: '/Users/kader/learn-node/lib/util.js', loaded: false, children: [], paths: [...] }
  • 45. exports, module.exports Exports variable inside each module is just a reference to module.exports. When we reassign the exports variable, that reference is lost and we would be introducing a new variable instead of changing the module.exports object. The module.exports object in every module is what the require function returns when we require that module. ~/learn-node $ node index.js In index Module { id: '.', exports: { id: 'index' }, parent: null, filename: '/Users/kader/learn-node/index.js', loaded: false, children: [], paths: [ ... ] } In util Module { id: '/Users/kader/learn-node/lib/util.js', exports: { id: 'lib/util' }, parent: Module { id: '.', exports: { id: 'index' } parent: null, filename: '/Users/kader/learn-node/index.js', loaded: false, children: [ [Circular] ], paths: [...] }, filename: '/Users/kader/learn-node/lib/util.js', loaded: false, children: [], paths: [...] }
  • 46. loading Loaded = false The module module uses the loaded attribute to track which modules have been loaded (true value) and which modules are still being loaded (false value). We can, for example, see the index.js module fully loaded if we print its module object on the next cycle of the event loop using a setImmediate call The exports object becomes complete when Node finishes loading the module (and labels it so). ~/learn-node $ node index.js In index Module { id: '.', exports: {}, parent: null, filename: '/Users/kader/learn-node/index.js', loaded: false, children: [], paths: [ ... ] } In util Module { id: '/Users/kader/learn-node/lib/util.js', exports: {}, parent: Module { id: '.', exports: {}, parent: null, filename: '/Users/kader/learn-node/index.js', loaded: false, children: [ [Circular] ], paths: [...] }, filename: '/Users/kader/learn-node/lib/util.js', loaded: false, children: [], paths: [...] }
  • 47. loading The exports object becomes complete when Node finishes loading the module (and labels it so). The whole process of requiring/loading a module is synchronous. This also means that we cannot change the exports object asynchronously. fs.readFile('/etc/passwd', (err, data) => { if (err) throw err; exports.data = data; // Will not work. });
  • 48. Wrapping In a browser, when we declare a variable in a script like this: var answer = 42; That answer variable will be globally available in all scripts after the script that defined it. This is not the case in Node, So how come variables in Node are magically scoped?
  • 49. Wrapping The answer is simple. Before compiling a module, Node wraps the module code in a function The wrapper function can be inspected using the wrapper property of the module module. ~ $ node > require('module').wrapper [ '(function (exports, require, module, __filename, __dirname) { ', 'n});' ] >
  • 50. Wrapping Node does not execute any code you write in a file directly. It executes this wrapper function which will have your code in its body. This wrapper function has 5 arguments: exports, require, module, __filename, and __dirname. This is what makes them appear to look global when in fact they are specific to each module. ~ $ node > require('module').wrapper [ '(function (exports, require, module, __filename, __dirname) { ', 'n});' ] >
  • 51. Wrapping exports is defined as a reference to module.exports prior to that. What happens is roughly equivalent to: function (require, module, __filename, __dirname) { let exports = module.exports; // Your Code… return module.exports; }
  • 52. The require object It’s an object that acts mainly as a function that takes a module name or path and returns the module.exports object. We can simply override the require object with our own logic if we want to. Now, every require('something') call in the script will just return the mocked object. require = function() { return { mocked: true }; }
  • 53. The require object The require object also has properties of its own. require.main which can be helpful to determine if the script is being required or run directly. require('module').do(); require.main !== module node module require.main === module if (require.main === module) { // The file is being executed directly (not with require) }
  • 54. What is the output? function yolo() { console.log('yolo'); } console.log('Hello there') module.exports = { yolo } require('./test').yolo(); require('./test').yolo();
  • 55. Caching All modules will be cached Node caches the first call and does not load the file on the second call. We can see this cache by printing require.cache after the first require. We can simply delete a property from that require.cache object to invalidate that cache. function yolo() { console.log('yolo'); } console.log('Hello there') module.exports = { yolo } require('./test').yolo(); delete require.cache[require.resolve('./test')] require('./test').yolo();
  • 58. Next Meetup : Kaldi Au programme : Intelligence Artificielle et Machine Learning, Deep Learning, Reconnaissance Automatique de la Parole (RAP), le challenge de la parole spontanée, variabilité du vocabulaire, du locuteur et de l'environnement, Kaldi : de la théorie à la pratique, Deep Learning en pratique : application à la RAP, échanges autour d'un cocktail !
  • 59. Happy to discuss with you