MongoDB / Monk / NodeJS / LocalHost



I’ve seen a lot of questions regarding localhost when using C9.

The tutorial i’m working on just has a few inserts saved in a mongodb and the .jade view will display the table inserts.

The tutorial says to add this code:

var mongo = require(‘mongodb’);
var monk = require(‘monk’);
var db = monk(‘localhost:27017/nodetest1’);

Do I just replace localhost with process.env.IP:27017 like this?:

var db = monk(‘process.env.IP:27017/nodetest1’);

I did this but am still having problems.

The userlist.jade file is very basic:

extends layout

block content
User List
each user, i in userlist
a(href=“mailto:#{}”) = user.username

When I start the application and attempt going to, it takes a long time to load, and it just loads the following HTML:

Error 502 - Bad Gateway .error_content { background: rgba(255, 255, 255, 0.23); padding: 10px; width: 641px; margin: 25px 0; display: none; }
#error-msg {
    display: block;

Error 502 - Bad Gateway

Please click here to try again, if the issue persists please contact support

  <a href="">Status Page</a> |
  <a href="">Support</a> |
  <a href="">Dashboard</a> |
  <a href="">Home</a>

Any help would be appreciated.