Presented by Arnaud Buchholz
Inspired from The definitive Node.js handbook from Flavio Copes
Presentation made with Reveal.js
JavaScript allows to create asynchronous and non-blocking code in a very simple way, by using a single thread, callback functions and event-driven programming.
When Node.js performs an I/O operation, instead of blocking the thread it will simply resume the operations when the response comes back.This allows Node.js to handle thousands of concurrent connections with a single server without introducing the burden of managing threads concurrency.
With its simple structure, the node package manager (npm) helped the ecosystem of Node.js proliferate.
Now the npm registry hosts almost 500,000 open source packages you can freely use.
...or learn from.2009 | 2010 | 2011 | ...2015 | 2016 |
---|---|---|---|---|
Node.js npm |
Express Socket.io |
LinkedIn, Uber Hapi |
Node 4 Foundation ES6 support |
Node 6 Leftpad 🐛 Yarn |
2017 | 2018 |
---|---|
Node 8 HTTP/2 Security focus 3 billion npm downloads/weeks |
Node 10 ES Modules |
Node is a single-threaded, single-process system which enforces shared-nothing design with OS process boundaries. It has rather good libraries for networking. I believe this to be a basis for designing very large distributed programs. The "nodes" need to be organized: given a communication protocol, told how to connect to each other.
node script.js
node
global.
const
is for constant assignmentconst
is not for constant valuelet
introduces block scoping to JavaScriptlet
does not benefit from hoistingfunction
this
, arguments
...)...
expands an iterable object into a list of parameters or elements...
is a collect syntax*async
functions are asynchronous and implicitly returns a promiseawait
operator is used to wait for a promiseconst multiply = (a, b = 1) => a * b
console.log(multiply(5)) // 5
class Rectangle extends Shape {
constructor (width, height, filled = false, color = "black") {
super(filled, color)
this.width = width
this.height = height
}
get area () {
return this.width * this.height
}
}
global
process
object
process.env
dictionaryprocess.argv
arrayconsole
APIs output on the command lineReading from the command line is not straightforward
Use Clone or download button
Check Node.js documentation of fs.statSync