Why do I see the following page on the Apache Web Server
Displays the code of the page?
http://localhost/main.js
I install Windows Installer.
I'm running all the code written in the Command Prompt But this code can not see inside the browser
In other words,
How do I run nodejs code in a browser ?
update,
My Code :
var http = require('http');
http.createServer(function (req, res) {
res.writeHead(200, {
'Content-Type': 'text/plain'
});
res.end('Hello World\n');
}).listen(1337, '127.0.0.1');
console.log('Server running at http://127.0.0.1:1337/');
First off.. Apache has nothing to do with node.
Start the main.js file by running node main.js and then navigate to where the node server is running (presuming main.js actually creates a web server). Check the port and hostname in main.js. Should be something like: http://localhost:8000