Node.js is an open-source, cross-platform,
back-end JavaScript runtime environment
that runs on the V8 engine and executes
JavaScript code outside a web browser.
Javascript was always a client side language until node.js.
Common server side languages include PHP, Python, Perl, Ruby
and several more. Node enables you to use Javascript server side.
This now means you can have a consistent language both ends
which could not be done prior to Node.
*
Node.js is an open-source server side runtime environment built on
Chrome's V8 JavaScript engine. It provides an event driven, non-blocking
(asynchronous) I/O and cross-platform runtime environment for building
highly scalable server-side applications using JavaScript.
Node.js = Runtime Environment + JavaScript Library
npm install http then write a webserver...
const http = require('http');
const PORT = 3000;
const server = http.createServer((req, res) => {
res.statusCode = 200;
res.setHeader('Content-Type', 'text/plain');
res.end('Hello World');
});
server.listen(port, () => {
console.log(`Server running at PORT:${port}/`);
});
Is a child of EventTarget
Node = DOM objects = Attr, CharacterData (which Text, Comment, and CDATASection are all based on), ProcessingInstruction, DocumentType, Notation, Entity, and EntityReference.
function isNode(o){
return (
typeof Node === "object" ? o instanceof Node :
o && typeof o === "object" && typeof o.nodeType === "number" && typeof o.nodeName==="string"
);
}