Although there are many good tips here, I would like to answer your question:
In other words, they can work hand in hand, like Apache / Perl or Apache / PHP, etc.
YES , you can run Node.js on Apache on the side of Perl and PHP IF , you run it as a CGI module. At the moment I canβt find the mod-node for Apache, but check out: CGI-node for Apache here http://www.cgi-node.org/ .
The interesting part of cgi-node is that it uses JavaScript just like you would use PHP to create dynamic content, serve static pages, access to an SQL database, etc. You can even share core JavaScript libraries between the server and the client / browser.
I think the switch to the same language between the client and server is happening, and JavaScript seems to be a good candidate.
A quick example from cgi- node.org:
<? include('myJavaScriptFile.js'); ?> <html> <body> <? var helloWorld = 'Hello World!'; ?> <b><?= helloWorld ?><br/> <? for( var index = 0; index < 10; index++) write(index + ' '); ?> </body> </html>
It is output:
Hello World! 0 1 2 3 4 5 6 7 8 9
You also have full access to the HTTP request. This includes forms, uploaded files, headers, etc.
I am currently running Node.js through the cgi- node module on Godaddy.
CGI- node.org has all the documentation to get you started.
I know that I raved about it, but finally made it easier to use something other than PHP. In addition, to be able to encode JavaScript on both the client and the server.
Hope this helps.
Uei Richo Oct 08 '14 at 16:06 2014-10-08 16:06
source share