NODE.JS

Node is a JavaScript runtime built on top of a V8 engine which is single threaded with non-blocking I/O.

RUNTIMES

Chrome uses the JavaScript engine V8. When it receives JavaScript as part of an html page (<script></script>), the script’s contents is sent to the V8 engine to execute.

Node.js can use the same code, but doesn’t need the browser. The node command effectively executes code from a filesystem on your server.

NON-BLOCKING I/O

I/O translates to input/output which in most cases refers to an HTTP connection.

NODE CALLBACK PATTERN

Node.js uses event models to manage asynchronous operations. Passing a callback function into another function allows the completion of an asynchronous operation to be responded to. Node uses an error first convention callback pattern. If the asynchronous operation trips an error, an error is passes as the first argument in callback.

function save(filepath, data, callback) {
fs.writeFile(filepath, data, function (err) {
//if an error is tripped, return the error
if(err) return callback(err);
console.log('Products saved successfully');
callback();
});
}
One clap, two clap, three clap, forty?

By clapping more or less, you can signal to us which stories really stand out.