Why people use node.js to provide http service? [closed] - node.js

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 9 years ago.
Improve this question
I just began to study web developing and heard that node.js can be easily used to deal with incoming HTTP requests. But I'm wondering why they don't simply use Apache or IIS? Under what circumstance would people prefer handling HTTP requests with their own code written in node.js? Thanks.

Go and have a look into the Raspberry PI community. I know that there this is discussed every once in a while to have a very lightweight server to do stuff. So I believe this is one occasion.
In reality it's though very common to have nginx or apache as a proxy before the node server. The proxy then handles all the heavy lifting like handling static files, while node handles the dynamic stuff.
Node.js compared to PHP is a completely different concept. While a PHP application is stateless, a Node application is stateful, meaning you start the application and it's just running, even when there's no requests, which would not be the case with PHP.

Related

I keep getting errors when I try to make a multiplayer game in python [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 2 years ago.
Improve this question
I have been running into problems recently where the client-side of a networking game never read/recognizes the server. When I tried to use the socket module the client never accepts the socket. I used a module called NetworkZero, but that never returned more than None when I used .discover(). I have no idea what the problem is. Any ideas are appreciated
There are many ways to set up an interface between clients and servers.
The easiest is probably to start with HTTP especially in Python where you can just use requests and poll for your data.
This will get you to prototyping quickly and then you can put your focus into optimizing when you start running into issues.
Of course this may be a less than optimal solution depending upon the nature of your game. Without context I would recommend using simple client/server communication systems you understand.

Can NodeJs be used on the web just like php [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 6 years ago.
Improve this question
Guys i'm new in Nodejs,
please can it be used on the web like php?
First you decide what type of situation you have.
If you want to make shopping site, social network etc which use large data processing , then you go for node.js (for example linkedin is made in node.js ).
But if your website does not require much data processing in server side you can go for php.
Nodejs is little difficult to use but once you use it perfectly your website will run smooth.
Both are good languages.
Yes you can easily use nodejs as a server side language.
Nodejs is faster than php. You can use nodejs to speedup your loading speed of your website.
Because nodejs heavily use callbacks.

Is it best to use Node.js or SignalR [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 7 years ago.
Improve this question
At the risk of this question being closed I will ask anyway.
I have been looking at the different JavaScript Frameworks as most jobs roles seem to want:
angular.js
Knockout.js
Node.js
Whilst i can see Angualr.js and Knockout.js provides a MVC construct to the markup pages (though still not sure which one is best to use) I cannot see what is the case for node.js?
Whilst I appreciate node.js is good for real-time comms but so is Signalr as they both use long-polling.
At present I use signalr to update images on my clients.
is there any purpose to swapping this out for node.js?
Like I said this question could be voted to be closed as it may seem to be asking an opinion - and that would be an answer to me in itself as it would be down to developer choice but is there a DEFINITIVE reason to use node.js over signalr?
thanks
One reason to use node.js is code redundancy. Both the server and client run the same language, thus they may share a certain part of the codebase, meaning potentially less to write. With libraries like Browserify this process can be made a lot more transparent and writing the client-side can be almost indistinguishable from server-side development. Another opportunity this opens up is both client and server side rendering + MVC setups with, for example, rendr.js. So you can have both the fast load speeds of server-side and responsiveness of client-side rendering. If any of this will be useful naturally depends on what you are developing.

dedicated servers for socket.io? [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 8 years ago.
Improve this question
One of the main features in my website is a simple One-to-One chat.
I'm debating whether or not I shall dedicate a server (or a cluster) for the sole purpose of this chat feature. The simpler option would be combining this feature as part of the web-servers and just scale out when necessary.
It is worth mentioning I'd like in the future to enable images transfer within the chat.
So what is the better option and why?
Well yes, Whether to use another dedicated server is not depending on how much traffic your site will have to handle. If you're dealing with images It will be a good idea to store them in another server and keep the root server clean.

What are the advantages of node.js compared to a simple mvc web framework which is run on something like nginx? [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 8 years ago.
Improve this question
I mostly write web apps using Python MVC frameworks which are run on top of nginx.
It's simple and it works. Nginx is pretty fast and Python is a joy to work with.
What exactly can I benefit from switching over to Node? Is there any specific job that Node is best suited for? From what I've seen it's a just cool single-threaded non-blocking process that does the job of both the server and your coding language in one. Javascript is cool too.
Where does Node really shine--if it does that at all?
Would I really be able to handle a lot more requests had I written my web app in node instead of a python mvc + nginx? And will those individual requests be fast as well (without much lag)?
nginx / apache:
upon getting a request:
start a process to run it (apache maintains a pool)
call io (file / database / external web service etc.) synchronously
(block wait for a response)
node.js / Tornado:
upon getting a request:
use current single thread process to run it (ignoring cluster for simplicity)
use async programming for io calls
given the above, node will perform better in an io intensive applications, but may become irresponsive in a cpu intensive ones.

Resources