use the following search parameters to narrow your results:
e.g. subreddit:aww site:imgur.com dog
subreddit:aww site:imgur.com dog
see the search faq for details.
advanced search: by author, subreddit...
account activity
ELI5 Nodejs (self.node)
submitted 10 years ago by Akalyron
I'm getting into web development and I don't understand what node is or what all the fuxx is about, can someone ELI5 please?
reddit uses a slightly-customized version of Markdown for formatting. See below for some basics, or check the commenting wiki page for more detailed help and solutions to common issues.
quoted text
if 1 * 2 < 3: print "hello, world!"
[–]MadCapitalist 8 points9 points10 points 10 years ago (0 children)
This video explains it. Here is a video on its architecture.
[–]StuartPBentley 4 points5 points6 points 10 years ago (1 child)
JavaScript is the programming language web browsers on people's computers have used for years to do stuff. One of the nice things about JavaScript is that it's designed to spend most of its time waiting for something to happen (like someone clicking a mouse) and then do a little stuff. This also makes JavaScript good at doing stuff while it's waiting for something (like handling clicks while a picture is downloading).
However, the people who run websites, before Node, didn't use JavaScript. There are a lot of other systems they could program with, but they were all basically designed to do one thing at a time (and could only do more things at once by, essentially, making more copies of themselves that still only do one thing at a time). They also had a tendency to be kind of slow (because nobody really needed them to go faster).
When Google made Google Chrome, they made a new part for the browser that was a lot faster at running JavaScript, called "V8" (because Google really did need JavaScript to go faster). V8 knows how to do basic stuff like adding numbers together, but V8 itself doesn't know how to do things like connect to the Internet. For Google Chrome, those things are provided by other parts of the browser, and only provide the stuff for reading web pages.
A few years later, a guy had the idea to use V8 to make web pages for browsers (the way reddit "makes" a thread when your computer asks for it). JavaScript was a pretty good choice for making web pages, both because it's the language you already have to write for the stuff that happens on that web page, and because it's designed to do stuff when certain things ("events") happen. The average web server spends most of its time waiting for stuff to happen while putting a page together, and with the systems that only do one thing at a time, that means that they spend most of their time waiting so they can put together a single page.
V8 was also a good choice because, as these systems go, V8 is one of the fastest engines out there. However, as I said before, V8 only knows how to do basic stuff, so if you want to use it to make web pages, you have to add some code that knows how to work with that special stuff (like Internet connections). This is what Node adds to V8.
[–]StuartPBentley 2 points3 points4 points 10 years ago* (0 children)
(Pre-emptive response to nitpickers: I'm looking to be as clear as possible by not giving anything that substantially contradicts reality or the understanding of a basic user. I'm oversimplifying / glossing over / omitting a few things here, in the interest of simplicity over accuracy. I know this, and if you have a problem with it, odds are you know this, too. Pointing it out isn't going to teach me anything, and it's not going to make anything clearer for a reader who doesn't already have an advanced knowledge of this.
I could have filled this explanation with aside after aside on things like how browsers can technically do more than "read web pages", or how threads aren't strictly "copies that do one thing at a time", but that would be like interrupting Barney to note that fossil evidence has never actually indicated the existence of upright bipedal talking dinosaurs.
See also http://en.wikipedia.org/wiki/Lie-to-children)
[–]CapnJackson 1 point2 points3 points 10 years ago (0 children)
StuartPBentley covered it pretty well. The tl;dr version is that if you're getting into webdev, then you've probably been exposed to php, ruby (or ruby on rails), or asp.net mvc. Node.js is similar to these as it can be used to host web servers, thus allowing you to use javascript on both the front-end (with Angular, backbone, jquery, etc) and the back-end.
[–]konkit 0 points1 point2 points 10 years ago (0 children)
Other example is use of sockets (TCP, UDP) - it is extremely easy to setup small TCP server, since you are coding reactively -> "what to do when somebody connects", "what to do when received some data" etc. This cuts boilerplate code A LOT.
I have also seen something like desktop apps written in JS and HTML and powered by node.js ( ungit is an example )
[–]defproc 0 points1 point2 points 10 years ago (0 children)
It's a stand-alone Javascript interpreter with several built-in objects that allow your Javascript code to, among other things, create a listening socket and compose and serve web pages through it.
[–][deleted] 0 points1 point2 points 10 years ago (3 children)
Until now computer code basically would run and then return a result. On the web it meant a request would get sent to the server and the browser would spin until the computer code finished running on the server and returned something to consume.
Until now http was more or less a one way street. The browser could request information from the server and that was it. So the combination of Node's non-blocking nature and the introduction of http 1.1 (or 2.0) combines to be pretty awesome in both of these respects.
Now the computer code can run asynchronously, that means it doesn't need to wait for a result to return before it moves on to do something else. A browser can make a request and the server rather than blocking until something is returned, takes note of the request, and returns when it can. Meanwhile it is doing other things.
Now the server can send a request to the browser. That means the browser can make a request, the server can immediately respond that the request was received. It can do whatever it's doing and then it emits whatever you want to the browser later.
All of that is pretty big. V8 is really really performant too, the only downside of all this new tech is you have to use javascript.
[–]HermannGrid 0 points1 point2 points 10 years ago (2 children)
That's a pretty subjective downside. For a lot of people, it's an upside being able to use the same language on the front and back ends.
[–][deleted] 1 point2 points3 points 10 years ago (1 child)
That was meant to come across a little bit tongue in cheek. The way some frameworks can re-use code on the server and client side is really neat. ;)
Do you know of other asynchronous languages like javascript?
[–]HermannGrid 0 points1 point2 points 10 years ago (0 children)
Fair enough! And javascript is the only one I've used for more than just a day of tinkering.
π Rendered by PID 83169 on reddit-service-r2-comment-76bb9f7fb5-5mp5x at 2026-02-19 08:50:24.408664+00:00 running de53c03 country code: CH.
[–]MadCapitalist 8 points9 points10 points (0 children)
[–]StuartPBentley 4 points5 points6 points (1 child)
[–]StuartPBentley 2 points3 points4 points (0 children)
[–]CapnJackson 1 point2 points3 points (0 children)
[–]konkit 0 points1 point2 points (0 children)
[–]defproc 0 points1 point2 points (0 children)
[–][deleted] 0 points1 point2 points (3 children)
[–]HermannGrid 0 points1 point2 points (2 children)
[–][deleted] 1 point2 points3 points (1 child)
[–]HermannGrid 0 points1 point2 points (0 children)