Solved

Node js info

Posted on 2013-12-05
12
68 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 82

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 82

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 82

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
Do You Know the 4 Main Threat Actor Types?

Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

 
LVL 82

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

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Suggested Solutions

Foreword (July, 2015) Since I first wrote this article, years ago, a great many more people have begun using the internet.  They are coming online from every part of the globe, learning, reading, shopping and spending money at an ever-increasing ra…
Developers of all skill levels should learn to use current best practices when developing websites. However many developers, new and old, fall into the trap of using deprecated features because this is what so many tutorials and books tell them to u…
Learn how to match and substitute tagged data using PHP regular expressions. Demonstrated on Windows 7, but also applies to other operating systems. Demonstrated technique applies to PHP (all versions) and Firefox, but very similar techniques will w…
The viewer will learn how to count occurrences of each item in an array.

744 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

16 Experts available now in Live!

Get 1:1 Help Now