nodeJS - Choose another port than 8080




I started a program on nodeJS with tutorial-point tutorial. It ask us to write :
at the end. it works when i launch server on my terminal with http://localhost:8081 and but impossible on C9

The lone way i found to launch the server :
.listen(process.env.PORT, process.env.IP);
So i have two questions, why the first way works on my term but not on C9? How can i do to code exactly like the tutorial?

I tried to modify the PORT variable from env C9 terminal with export command-line but it didn’t work

thanks a lot !


Localhost on c9 works same way on as on your local machine.You can check that by running server with .listen(8081); and then curl http://localhost:8081 from another terminal.
But you need to pass ‘’ as ip (.listen(8081, '');) to be able to access the server from other computers.


It looks like the problem is different. it works with or not. On my term when i click on the link, it sends me on an error page with the message The connection has timed out, but when i copy/paste http://localhost:8081 as URL it works.

so the problem is solved.

Thanks for the help


With localhost you are accessing the server running on your local computer, server running on cloud9 can be accessed from


here my code

var server = http.createServer(function (request, response) {

response.writeHead(200, {'Content-Type': 'text/plain'});
response.end('Hello world');
}).listen(8081, '');

console.log('Server running');

i did curl http://localhost:8081 and i get ‘Hello world’ on my term and when i go to the ‘real’ url : i have a page with “No application seems to be running here!”


without port is try


no change, with server running and the display “hello world” from curl, display an error page: The connection has timed out


curl doesn’t work because your workspace is private
opening that page in browser will work


thanks a lot, it works !
Last thing but not very important. When I try to open it on a new tab from my firefox on Linux it’s impossible, but on firefox and chrome on Windows it works without problem. what could it be ?


How do you open it on a new tab, are you logged in to your c9 account on that browser


by clicking on the url on previous post or copy-past. The same url work on my second computer (Window).
On my centOS i’m logged in but not on my windows