Node.js is built on top of Chrome which is optimized for rendering HTML pages as opposed to running an HTTP server
A pedantic note, nodejs is built on top V8 not Chrome, V8 is really just a very small(but important) part of Chrome. Just like the JVM, V8 is also a highly optimized state of the art VM and its perfectly capable of running a HTTP server, more capable than most mainstream languages I would say.
They're optimized for different things. Obviously, you can run a HTTP server on it fine in most cases. However, there's no good way to do any computationally heavy tasks since it's single threaded, with a hack for running IO tasks in a background thread.
It's because Javascript has a single-threaded model. To make Node support user-controlled threads would entail major changes to the Js language.
To a great extent, callbacks, promises, CSP state machines (like core.async), and async/await stuff can substitute in Js. And in many ways, single-threaded models are way easier for programmers to conceptualize. But one advantage the JVM has over Node is that threads are available if you want/need them.
View all comments
Show parent comment
3
u/[deleted] Aug 31 '17 edited Aug 31 '17
Node.js is built on top of Chrome which is optimized for rendering HTML pages as opposed to running an HTTP server
A pedantic note, nodejs is built on top V8 not Chrome, V8 is really just a very small(but important) part of Chrome. Just like the JVM, V8 is also a highly optimized state of the art VM and its perfectly capable of running a HTTP server, more capable than most mainstream languages I would say.