I have created a Node.js Droplet on Digital Ocean.
I have connected to the server with FileZilla and uploaded all the Node.js files (index.js, package.json, etc.).
I am trying to start the server with node index.js
. It says
App is running at http://localhost:3000 in development mode
Press CTRL-C to stop
However, I am not able to see the website neither on the public IP address provided by Digital Ocean nor on localhost:3000
.
How do I start the Node.js server correctly?
Edit
I am setting up the server with this (content of index.js
):
const express = require('express');
const app = express();
app.set('port', process.env.PORT || 3000);
app.listen(app.get('port'), () => {
console.log('App is running at http://localhost:%d in %s mode', app.get('port'), app.get('env'));
console.log(' Press CTRL-C to stop\n');
});