Report this

What is the reason for this report?

use nodejs API on port 6000

Posted on April 3, 2018

i setup a nodejs droplet. installed pm2 and copied the files to a folder with filezilla. also created a firewall to allow traffic on port 6000 and linked it to the droplet. ran the app with pm2 start app.js

note: this is my first time using digitalocean note: tried doing calls to my ipv4 address aswell as the floating one



This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

By default node.js will listen only on localhost/127.0.0.1 for local requests. If you specify the IP address in your app as 0.0.0.0 it will listen on all IPs. Another option is to enter only the IP it will be used with (if using a floating IP this is the anchor IP, not the public floating IP users will use).

This shows an example that should listen publicly on port 6000 as long as there is not a firewall blocking it.

var http = require('http');

http.createServer(function (req, res) {
    res.writeHead(200, {'Content-Type': 'text/plain'});
    res.end('Hello World\n');
}).listen(6000, "0.0.0.0");
console.log('Server running at http://0.0.0.0:6000/');

digital ocean blocking by default port above :6000 , dont know the reason but , if you will run node less then 6000 then only its working fine for web and APK else only working on APK…

The developer cloud

Scale up as you grow — whether you're running one virtual machine or ten thousand.

Get started for free

Sign up and get $200 in credit for your first 60 days with DigitalOcean.*

*This promotional offer applies to new accounts only.