I'm encountering an issue with my Server.JS file while trying to connect Deployd to Heroku. Despite configuring the mongoDB port to 5000 in Nitrous, I keep getting an error. Any assistance would be greatly appreciated. Thank you!
Server.JS
// require deployd
var deployd = require('deployd');
// database configuration
var server = deployd({
port: process.env.PORT || 5000,
env: 'production',
db: {
host: '0.0.0.0',
port: 5000,
name: 'database_name',
credentials: {
username: 'username',
password: 'password'
}
}
});
// setting up sockets for Heroku
server.sockets.server.set('transports', ["xhr-polling"]);
// start the server
server.listen();
// debugging
server.on('listening', function() {
console.log("Server is listening on port: " + process.env.PORT);
});
// Error handling for Deployd
server.on('error', function(err) {
console.error(err);
process.nextTick(function() { // Ensure proper error handling
process.exit();
});
});
ERROR:
db:error Error: Cannot open store: MongoError: server 0.0.0.0:5000 timed out
at /home/nitrous/Find-Volunteerships/node_modules/deployd/lib/db.js:144:17
...
{ [Error: listen EADDRINUSE :::5000]
code: 'EADDRINUSE',
errno: 'EADDRINUSE',
syscall: 'listen',
address: '::',
port: 5000 }