Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

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
  };
}
Comment

PREVIOUS NEXT
Code Example
Javascript :: check trigger is human jquery 
Javascript :: acceder a variable css desde js 
Javascript :: email validation in form using javascript 
Javascript :: combine strings in angularjs 
Javascript :: 5.1.3. Boolean Expressions¶ 
Javascript :: my code agly because alot of if and else dev community 
Javascript :: how to load image in hbs document 
Javascript :: javascriot html eqaul to jquery 
Javascript :: @rematch/loading 
Javascript :: jquery crud table example 
Javascript :: p5 js stop video camera capture 
Javascript :: react-native-gesture-handler-react-native-animated-2-tried-to-synchronously-c 
Javascript :: Changing Async/Await to Promises.all to Speed Up API Calls in Node.JS 
Javascript :: after storing array array state is empty 
Javascript :: setstate too slow 
Javascript :: observables loop in template angular 8 
Javascript :: Example code of using inner blocks in Wordpress with ES5 
Javascript :: date filter in angular 8 
Javascript :: javascript array keyshort 
Javascript :: expo google sign inredirect uri mismatch 
Javascript :: close worker 
Javascript :: reuse jquery angular 
Javascript :: jshack1 
Javascript :: how to apply scrollbar in textarea 
Javascript :: getting ad to close jquery 
Javascript :: React Readonly rating 
Javascript :: customize bar in chartjs 
Javascript :: add remove to array vue js 
Javascript :: cantsee auto complete for node jsmodules in vs code 
Javascript :: Arrays in Apps Script 
ADD CONTENT
Topic
Content
Source link
Name
2+6 =