Hello Guys,
We can easily connect the Nodejs with xampp by follow simple steps -
Nodejs required a specfic port to run on system and defaluts port is 8080, So let's starts
- Download Nodejs form its website ,If node is installed successfully then open terminal or Git Bash to check
Run command : node -v and npm -v it gives node version ,If it shows then you installed the node successfully.
- Install It whole package, After then make folder in any drive with any name let's I take node_code in c drive so my path is :
c:/node_code
- Now Install Xampp (If not installed )download.html, and run Apache , If no error on, then we are almost done.
- Now create a .js file in node_code folder let name that first_node.js and the below code :
var http = require('http');http.createServer(function (req,res){ res.write('Nodejs started using xampp'); res.end();}).listen(8080); console.log('http server started');
- Now open Git Bash or Command prompt on which you run the node -v command and navigate to the node_code folder by cd command
- Now use Command
node first_node.js
- after run this command you will see "http server started" appear on command prompt.
- Now Open any browser you have run localhost:8080 you will appear a writemessage.
"Nodejs started using xampp"
- That it, Nodejs connected with Xampp. By using same concept you will connect your server to Nodejs and run Nodejs on your website.
Thanks
- Log in to post comments