Is it recommended to run NodeJS on an IIS server? - node.js

Im moving to MEAN stack, and I am migrating an application originally developed with .NET framework to Angular and Node, but using mssql with Node, so its not really a mean solution. Anyway, so far Im fascinated with the simplicity and coding speed of Node.
Im utilizing Nodemon at the server, and developing from home in Angular. I opened port 3000 at the server and I point my angular http calls to http://xxx.xxx.xxx.xxx:3000. Everything is perfect so far; but at some point I will have to move to production and that's where my doubts begin.
I was reading several articles on the Internet about running Node on an IIS by utilizing reverse proxies, URL rewrite, installing PM2, installing Node as a service, etc; but I am not quite convinced this is the right way to expose the APIs to the internet. Some articles say IIS is "the way to go" while others say it may cause conflicts when Node crashes (?).
The question is then, is it recommended to run Node over IIS, which is what I know and Im confortable with, or should I use Express to expose my APIs to the internet?
Thanks.

Related

Why is express.js app almost always behind nginx or other web server?

I have seen tons of examples and read tons of articles about nodejs express app deployment. Almost always after implementing all logic (including serving static files) in express, the next step is to forget all the claims about how incredibly fast node.js is and how amazing it is in all benchmarks for concurrent requests. After you no longer remember the reasons why you learnt this amazing new technology which changes the world and how we think of web applications, there you go and install good old nginx to act as an entry gate to your express app.
Don't get me wrong, I understand all the features of nginx, having deployed tons of PHP apps with nginx in my days. But simply put, why? Why not let my app be balanced by pm2 e.g., run it on all cores of my VPS and have node.js native clustering support handle the load balancing?
Obviously, I am talking about the case of using a single machine for the app, not deploying it to multiple VPSs. Then a load balancer of some sort again does make some sense.
Thank you anybody who can explain the reasons for using a web server to forward traffic to another webserver.
You can use nginx server to serve static content of your application instead of nodejs.
As nginx is better at serving static content like html, css, js & image files than nodejs.
And another thing is in case of crashing of any node service, you can show proper error pages using nginx.

What is the main purpose of NodeJS internal HTTP Web Server?

I'm currently learning NodeJS and pretty excited about it.
But here is one thing that I am unsure and need help about.
As we know that NodeJS has its own internal http web server and we can simply create using http.createServer() method.
My questions are:
Is the internal http web server that NodeJS has, meant to replace similar http web server like Apache or Nginx?
If I need to create enterprise-scale application, does NodeJS internal web service capable of doing this? Or do I need to still use Apache/Nginx?
Please help. Thank you.
Adrian
node.js does not require a web server the likes of Apache or nginx, it is its own web server.
Walmart has used node for, in their words, "end-to-end javascript"... that is certainly enterprise-scale, though they don't explicitly say they're relying on http.createServer, end-to-end javascript would eliminate Apache or nginx and I doubt they've developed some exotic solution (though socket.io is a possibility)... generally speaking if you're using node on the web, you're using the built in web server in at least some capacity.
There perhaps is some benefit to using nginx as a reverse-proxy/static file server on the front end. If I were designing my "perfect system" I'd probably do that, but I'd still be passing back requests to the built in web server in node.
You don't need to use Apache or Nginx with node.js, but in practice, its probably a good idea.
Basically, Apache would sit in front of your node.js, and relay requests to and from your node app, using something like mod_rewrite.
The node http server module is great for firing up quick applications, but if you need things like SSL, complex mod_rewrites, directory security, detailed logs etc (ie all the stuff you would need in a commercial application), you need (or at least, its easier) to use Apache or Nginx in front of node.

Is NodeJS supposed to be standalone (I.E. without apache nginx)

Ok so finally decided I was way behind in knowing some of the frameworks/platforms that are out like Angularjs, NodeJS, Knockout, Backbone etc etc. And so decided to learn NodeJS first, and have set it up on a local vm of ubuntu server.
So was wondering if NodeJS was supposed to be paired with another server software like apache,nginx, etc. And let apache/nginx just serve up the basic pages and then just let node do the data communications since their site says its "for easily building fast, scalable network applications".
Because I have seen several questions on S.O. asking how to get NodeJS to run on port 80, which implies they want to run node as a regular server or they just dont want to have to always specify a port when doing requests. And have not seen anyone comment or say that node was not meant to be used like a regular server. So was hoping to get to an answer on this.
Node.js can be used standalone, out there are good frameworks to do it like express. You can clusterize your process in the same physical machine (and the same port) really easy via its native module cluster. Also, I'm sure you can use Node.js like a reverse proxy too, but some developers prefer using other tools to do it (in my enterprise, we use Nginx with some of our node.js apps).
So, in short: You dont need Nginx or Apache at all, but you can use if you want. It's very cosy to some people use Nginx to do the load balance, or even other stuff like handle the https or server static content. It's your choice at the end.
You should play something with the native library http or https first, and then check express or another framework. You will see wich parts of Node.js you love and which do you dont feel awesome.

hostgator vps level 1 & node.js

I've acquired a hostgator vps level 1 account to use with node.js development. But when it comes to servers I'm a bit of a noob so I was wondering if the more experienced developer could give me suggestion of to setup my new account to work best with node.js. What would you recommend me to install. Apache? Python? Php? and so on?
Would you recommend me to use Haraka as an email server?
I'm planning to use this server for websites and services with node.js as the backend.
Any suggestions would be appreciated and could possible be good for other getting the same type of account. =)
PHP and Python have no relation to Node.js/Javascript. Remember that, unlike PHP apps which rely on a third party web server (i.e. Apache/Nginx/IIS), Node.js apps act as their own web server. If you don't need Apache, don't install it. It takes up resources and will most likely be listening on port 80 (preventing your node app from doing so).
Node requires only a very minimal environment. You should install Node.js, and probably a C++ compiler. Other than that, it simply depends on what you need for your particular app.
There are lots of resources for how to get started with node. For example: https://stackoverflow.com/a/5511507/2210128

Decent Node.js library for server workload testing

I'm about to develop a web app so i tought i could test the workload with a single Node client since it can make multiple calls to the server without blocking.
Looking at https://github.com/joyent/node/wiki/modules, in the testing section i foun plenty of frameworks, and my question is if someone can recommend or has heard good things from any of those.
I think this is a perfectly answer question, that's why im asking it here.
Edit:
The idea is to use node on the client side not the server that serves the webapp, so profiling would be out of scope when it comes to decide what node testing framework to use.

Resources