I am new to using nodejs completely, and it seems to be pretty much the go to thing for everything right now. But I program in Visual Studio, and I'm a bit confused about how this works. I will cite an example;One task I want to do is to get a list of all the files in a directory and all of its sub-directories, and return them as a string[] for a javascript .config file. I started searching for that and found a lot of answers, but they all kept going back to nodejs, for instance, this one, and this one, and this one.I really wasn't looking for anything having to do with nodejs, it just seems to be part of every solution out there. I've installed it, and gotten it to where I can do some simple things like create a very basic server that listens to a port - thanks to simple tutorials written for a moron like me - but I'm having a hard time figuring out how to use these kinds of things in my real programs - specifically ASP.NET MVC. I've searched pretty hard on this topic too, and discovered things like iisnode and the like that do some partial integration.But even with all of this, this wealth of information, I am extremely confused. I understand that I can use it from a command line, like PowerShell, I can run commands from a terminal, and install packages into projects, but I'm having a hard time seeing and finding how this actually translates into literal, real usage in an existing application. I have scoured around for days and days for examples, I've read at least 3 books on nodejs, The Node Beginner Book, What is Node, and Professional Node.js and to be very honest I am still as lost as ever.Everything I read keeps assuming I am doing things from the command line or a terminal, but all of the applications I see for node assume you're writing a web application. I'm having a really hard time wrapping my head around how you use it within an application. Can anyone assist me with this? Perhaps a working example of an actual program that uses node? I'll take almost anything at this point, though ASP.NET MVC is my core system of choice.I was originally going to post this on StackOverflow, but someone suggested that this community was more appropriate for this question.UpdateI want to make a more clear example of what is confusing me, I'm already learning because of the 1 proposed answer, but let me give more examples.I program in Visual Studio, it has no real concept of node.js - in fact, if I try to do things that will run against node, it gives me problems. I often have to code anything related to node in WebStorm from JetBrains. I understand that I can 'compile' things with node, what I don't understand is how I can invoke it within my program, not inside of a command line. For example let's say there is a node module that takes an array and does something to it - for sake of example let's say that it sorts everything in the array alphabetically, and it is a module called supersort. So if I were at the console, I would just type in ...node supersort.jsOkay, but now I'm not at the command line. I have published my web application. My user is at a page, let's say /account/history and they are seeing a list of every product they have bought. For the sake of argument, say I've got that list as a object[] or string[] - I realize that is completely absurd and it would be far more complex, but just jive with me.I want to run supersort on this page. But it's live! How do I do it? How do I run this module on their live, active data without manually being there at the console? Is there a set of javascript files I'm supposed to download and call http requests a certain way? Do I wire up a special IHttpHandler in IIS? I think you can start to see where I am lost. Update 2Attempting to further emphasize my question, I'll try and cite a more specific example. I want to use the library Q.js in my ASP.NET MVC application. Now, there is a version 1 that I can seem to run out of the box, but I want to try out version 2 - you can find it linked Q.js v2 (beta)So I am using Visual Studio, and I'll download the q.js file and load it up, but immediately we already have trouble now - if you look at the file's source code right away I see this.require(collections/shim);var WeakMap = require(collections/weak-map);var Iterator = require(collections/iterator);var asap = require(asap);Now I certainly don't have folders with those names in my application - and even though I have node.js installed, putting this file in a <script> tag does not work, as it says it cannot find the specific libraries. If I go to a console explicitly and type in npm install -g q@~2, it will create a folder called node_modules/q in my AppData/Roaming/npm folder, and this one does have folders for those other libraries.So what is the right way to do this? It's clear that just having node installed doesn't make node commands work when I try to run the page in ASP.NET MVC - but I also don't understand how to get to the final version of the library that I can include on my application like a normal javascript file and use across the program.
confusion on using nodejs within an actual web application or ide
node.js
node.js (not nodejs, as you seem to put it), is a server side technology.In that respect, it is like Apache or IIS - web servers. It can and mostly is used as a backend for web applications (and web based APIs) - it serves up whatever it is coded to serve up (in that respect, no different from Apache and IIS).If you code up a web application (serving HTML and whatever else is involved in writing a web application) in node, that's what it would be serving, a web application.The reason you see a lot of discussion of the command line/terminal is that there is no GUI for node. One is expected to use an editor to write the node application and run it from the command line. It is not wrapped up in a service for you, like IIS.