title: How to read key values from a property file in javascript
body: <p>I want to read properties from a config file - in a key value pair format from my main.js</p>
  
  <p>I have a config file config.json</p>
  
  <pre><code>{
   "IGUrl": "xyz",
   "Key": "abc",
   "dbName": "node-login"
  }
  </code></pre>
  
  <p>I want to read the property say "IGUrl" from my app.js.</p>
  
  <p>The code to access and read this file is</p>
  
  <pre><code>    var config  = require('./config.json');
      var x = config.IGUrl;
      console.log("TEST URL " + x)
  </code></pre>
  
  <p>But this is giving me an error 
  Uncaught TypeError: Cannot read property 'IGUrl' of undefined</p>