mo_maat
mo_maat

Reputation: 2240

nodejs and mongodb remote access through application

I have a web app setup using nodejs and mongodb and backbonejs.

When I run my app remotely and try to redirect to a different route through the uri, for example: http://www.myapp.com/route I get a net error.

In my route.js file I have the following:

  var mongodb = require('mongodb');
   var db = new mongodb.Db('dbname', new mongodb.Server('xx.xx.xxx.xxx', 27017, {}));

where xx.xx.xxx.xxx is my public ip. However, when I change this to anything other than "localhost" and try to run node server.js in the root of my app I get the following error:

Listening on port 3000...

/var/www/html/pages/node_modules/mongodb/lib/server.js:236
        process.nextTick(function() { throw err; })
                                            ^
Error: connect ECONNREFUSED
    at exports._errnoException (util.js:746:11)
    at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1012:19)

I have already uncommented bindIp in my /etc/mongod.conf file as suggested in other posts. I did this only to test and just to get it to work, but I plan to go back and play with the ip tables if I get this to work.

How can I access my app remotely?

Upvotes: 0

Views: 212

Answers (0)

Related Questions