I'm learning node.js and am trying to connect to the server I've created but my browser won't connect. I'm testing on a live server.
My server.js in my /public_html consists of this:
var http = require("http");
function onRequest(request, response) {
response.writeHead(200, {"Content-Type": "text/plain"});
response.write("Hello World");
response.end();
}
http.createServer(onRequest).listen(8888);
console.log("Server has started");
which I launch from the console via node server.js and I get the "Server has started" message but when I point my browser at myhost.com:8888 it won't connect., after trying for a long time I get Error 101 (net::ERR_CONNECTION_RESET): The connection was reset. What am I forgetting?
the code should work on localhost - I tested. Are you able to access the IP address and port e.g. 23.25.125.87:8888 (instead of myhost.com:8888) - not sure if you have looked into DNS changes (or if they gone into effect if you have already done that)