catalancho
11/23/2019 - 6:16 PM

What is Node.js if it is not a programming language?

Before node.js you could run a js interpreter from the command line. But, most people didn’t know that.

Node.js includes that interpreter. And, it extends the language class library with new built in classes especially for handling file and network I/O with a preference for asynchronous patterns.

For security reason, javascript originally did not include file I/O for use in the browser. And, it did not need to do networking tasks, because the browser does them. Javascript was built out with the DOM for the browser.

Node.js does not include any specific libraries for work on the DOM. There are likely some module you can get that do.

So, the original idea of node.js was to be able to set up a web service or a tcp server really fast. You could, and still can, just copy a code snippet, put it in a js file and then run it with node, and you will have a server - presto!

(note: the code for the node.js part is written in C and uses libuv to build the event handling pattern for file descriptor handling. The underlying javascript interpreter for v8 is also written in C. )

If you run the same file with just v8, you will probably get errors for non-existent classes.

So, that is the answer.

(I have had this experience where critical types tried to explain songs to me that I actually had sung to people, but they didn’t know that I had anything to do with them because I kept myself anonymous. Sometimes this happens with a few things in comp sci as well. It’s always a little humerus when you realize how off some experts can be. But, it also grows a little old.)