check if node is running localhost code example
Example: node check if running on localhost?
var os = require('os');
var database_uri;
if(os.hostname().indexOf("local") > -1)
// Server running on Localhost
database_uri = "mongodb://localhost/database";
else
// Server running on remote server
database_uri = "mongodb://remotehost/database";