node check if running on localhost 3f

Solutions on MaxInterview for node check if running on localhost 3f by the best coders in the world

showing results for - "node check if running on localhost 3f"
Bogdan
30 Feb 2016
1var os = require('os');
2var database_uri;
3
4if(os.hostname().indexOf("local") > -1)
5  // Server running on Localhost
6  database_uri = "mongodb://localhost/database";
7else
8  // Server running on remote server
9  database_uri = "mongodb://remotehost/database";
10
11