Answers for "conditional statement for node on internet and node local server"

0

conditional statement for node on internet and node local server

if(os.hostname().indexOf("local") > -1){
  const DATABASE = 'local_database';
  var options = {
    host: 'localhost',
    port: 8889,
    user: 'root',
    password: 'root',
    database: DATABASE
  };
}else{
   const DATABASE = 'online_database';
  var options = {
    host: 'localhost',
    port: 3306,
    user: 'online_username',
    password: 'online_password',
    database: DATABASE
  };
}
Posted by: Guest on March-22-2022

Code answers related to "Javascript"

Browse Popular Code Answers by Language