Solved

Node js info

Posted on 2013-12-05
12
69 Views
Last Modified: 2015-05-01
Hi,

I am Newbie in node.js. I want to know how to integrate it into php. I have install node js in windows. If possible please do let me know how to run it in browser . Tried to run below code but when run on browser it downloads the page. Do i have to install some other package like memcache and so on . Using xampp on windows .

var http = require('http');
http.createServer(function (req, res) {
  res.writeHead(200, {'Content-Type': 'text/plain'});
  res.end('Hello Node.js\n');
}).listen(8124, "www.test.com");
console.log('Server running at http://www.test.com:8124/');
0
Comment
Question by:Insoftservice
  • 6
  • 4
  • 2
12 Comments
 
LVL 83

Assisted Solution

by:Dave Baldwin
Dave Baldwin earned 400 total points
ID: 39699266
Node.js is used to make servers, not to be used in them.  Please read the info here: http://nodejs.org/  I do not believe that Node.js can run PHP or in PHP.
0
 
LVL 15

Author Comment

by:Insoftservice
ID: 39700151
So, if i want to implement it on browsers how to do that.
0
 
LVL 83

Assisted Solution

by:Dave Baldwin
Dave Baldwin earned 400 total points
ID: 39700234
Node.js does not run in a browser.  It runs on the server and is used to create the server functions.

Regular javascript runs in your browsers, not Node.js.
0
 
LVL 15

Author Comment

by:Insoftservice
ID: 39705516
But how to execute node.js then and utilize it in server
0
 
LVL 83

Assisted Solution

by:Dave Baldwin
Dave Baldwin earned 400 total points
ID: 39705533
You have to install it in your server.  Then you can use the examples on http://nodejs.org/ to create useful functions.
0
 
LVL 15

Author Comment

by:Insoftservice
ID: 39705914
tried but when tried to execute the example it downloads the page.
0
Zoho SalesIQ

Hassle-free live chat software re-imagined for business growth. 2 users, always free.

 
LVL 83

Accepted Solution

by:
Dave Baldwin earned 400 total points
ID: 39706559
Using Node.js is not as simple as writing a web page.  You have to make use of the libraries that exist to create a web server that will understand page requests.  There are a lot of examples there and you will just have to work thru them.
0
 
LVL 15

Author Comment

by:Insoftservice
ID: 39714894
var http = require('http');
http.createServer(function (req, res) {
  res.writeHead(200, {'Content-Type': 'text/plain'});
  res.end('Hello Node.js\n');
}).listen(8124, "www.test.com");
console.log('Server running at http://www.test.com:8124/');

As per question i had tried with some examples but instead of giving me o/p its downloading the page
0
 
LVL 42

Assisted Solution

by:Rob Jurd, EE MVE
Rob Jurd, EE MVE earned 100 total points
ID: 40529671
Are you still having issues with Node?  I've since started using it quite a bit and can offer some assistance if necessary?
0
 
LVL 15

Author Comment

by:Insoftservice
ID: 40565793
yes i still had the issue . but had currently stopped using it. but would surely try it out today or tomorrow from scratch .
0
 
LVL 42

Expert Comment

by:Rob Jurd, EE MVE
ID: 40565800
Post your issues and I'll have a crack for you
0
 
LVL 15

Author Closing Comment

by:Insoftservice
ID: 40755514
Sorry I am too busy to do RND on node js . But surely if i get time i will try to  work on it again.
Thanx all for ur valuable comments .
0

Featured Post

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Build an array called $myWeek which will hold the array elements Today, Yesterday and then builds up the rest of the week by the name of the day going back 1 week.   (CODE) (CODE) Then you just need to pass your date to the function. If i…
Introduction This article is intended for those who are new to PHP error handling (https://www.experts-exchange.com/articles/11769/And-by-the-way-I-am-New-to-PHP.html).  It addresses one of the most common problems that plague beginning PHP develop…
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …

867 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now