title: Where should be located a database config file in Node.js and Express?
body: <p>I'm now learning Node.js and Express, and want to use <code>mysql</code> module to render multiple unique pages, so instead of writing out <code>var connection=mysql.createConnection({user:'root', password: 'root'...etc})</code> line on every file located under <code>routes</code> directory, I'm sure it's better off to just call my own mysql config file on each routing file.</p>
  
  <p>However, where should I put the config file on Express hierarchy and how can I call the file from within each routing file? I know all images, style sheets, and javascript files should be located within each specific directory under <code>public</code> directory, but I don't know where to put all the other files that are intended to be accessed from routing files.</p>
  
  <p>I also want to know whether all of my files, ranging from main <code>app.js</code> to files under <code>routes</code> directory to files under <code>public</code> directory, etc... can be found by users once I publicize this web application on the Web. If it's the case, then I think I should not put database config file on directories that clients can access to...right? In other words, I want to make sure which files can be accessed to by clients and which cannot in order to avoid security attacks.</p>