📌  相关文章
📜  节点检查是否在本地主机上运行? - Javascript代码示例

📅  最后修改于: 2022-03-11 15:04:17.856000             🧑  作者: Mango

代码示例1
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";