What is "server" in server-side javascript like NodeJS?

Divs picture Divs · Dec 29, 2015 · Viewed 34.6k times · Source

Is it not a Javascript engine hosted by the browser on the client machine itself?

Answer

Quentin picture Quentin · Dec 29, 2015

No, it isn't.

Server generally has two meanings:

  1. A piece of software that listens for network requests and then responds to them
  2. A computer running such a piece of software

A Node.JS server can be either of those.

In web programming, a Node.JS server takes the place of Perl, Python, Ruby, PHP, Scala, etc. (And like those other languages, Node.JS lets you use JavaScript for non-server and non-web purposes).

Generally the server itself is run directly from Node (e.g. with this library) rather than being embedded in another server like Apache (as is most common for PHP).

A browser doesn't need to be involved at all. If one is, then it will probably be one acting as a client and making a request to the server. That said, tools like PhantomJS can allow a browser to be driven from Node (and other programming languages).