title: Express: accessing app.set() settings in routes
body: <p>In Express, I'm led to believe that global app settings can be created by doing something similar to the following in my main <code>app.js</code> file:</p>
  
  <pre><code>var express = require('express'),
      ...
      login = require('./routes/login');
  
  var app = express();
  
  app.configure(function(){
    ...
    app.set('ssoHostname', 'login.hostname.com');
    ...
  });
  ...
  app.get('/login', login.login);
  ...
  </code></pre>
  
  <p>now in <code>./routes/login.js</code>, I'd like to access <code>app.settings.ssoHostname</code>, but if I attempt to run anything similar to (as per: <a href="https://stackoverflow.com/q/13361072">How to access variables set using app.set() in express js</a>):</p>
  
  <pre><code>...
  exports.login = function(req, res) {
    var currentURL = 'http://' + req.header('host') + req.url;
    if (!req.cookies.authCookie || !User.isValidKey(req.cookies.authCookie)) {
      res.redirect(app.settings.ssoHostname + '/Login?returnURL=' + encodeURIComponent(currentURL));
    }
  };
  ...
  </code></pre>
  
  <p>it does not recognize <code>app</code>:</p>
  
  <pre><code>ReferenceError: app is not defined
  </code></pre>
  
  <p>My questions are:</p>
  
  <ol>
  <li>Is the approach I took of using <code>app.set()</code> for global settings that will be re-used often the "proper" way to do it and if so...</li>
  <li>How do I access these settings in routes?</li>
  <li>If not using <code>app.set()</code> for global settings to be used often, how would I set and get custom settings in routes?</li>
  </ol>