how to check server running on 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";