title: adding route using app.use() inside eval() produces error, runs fine without eval()
body: <p>I have a class for adding routes to my API:</p>
  <pre><code>class RouterLoader{    
      constructor(app){
          this.app=app;
      }
      loadRoutes(){
          eval(`var indexRouter = require('./routes/index');`);
          eval(`this.app.use('/',indexRouter);`);
      }
  }
  
  module.exports = RouterLoader;
  </code></pre>
  <p>I am using <code>eval()</code> because I want to loop through all the files in <code>./routes</code>, adding each route using the same <code>require()...app.use()</code> (if there is a better way to add all routes, I'm open to suggestions).</p>
  <p>Here is the <code>index.js</code> file I am using for this <code>app.use()</code>:</p>
  <pre><code>var express = require('express');
  var router = express.Router();
  
  router.get('/', function(req, res, next) {
    res.render('index.html');
  });
  
  module.exports = router;
  </code></pre>
  <p>And here is where I actually call <code>loadRoutes</code> in my <code>app.js</code> file:</p>
  <pre><code>const RouterLoader = require('./routerLoader');
  const routerLoader = new RouterLoader(app);
  routerLoader.loadRoutes();
  </code></pre>
  <p>This gives me the error:</p>
  <pre><code>this.app.use('/',indexRouter);
                   ^
  ReferenceError: indexRouter is not defined
  </code></pre>
  <p>However, when I remove the <code>eval()</code> calls, like this:</p>
  <pre><code>    loadRoutes(){
          var indexRouter = require('./routes/index');
          this.app.use('/',indexRouter);
      }
  </code></pre>
  <p>Then the code executes successfully and the REST endpoint is accessible as expected.</p>
  <p>I thought it might be a scope issue, so I changed the <code>app.use()</code> to:</p>
  <pre><code>        eval(`this.app.use('/',this.indexRouter);`);
  </code></pre>
  <p>But then that gave me the error:</p>
  <pre><code>TypeError: Router.use() requires a middleware function but got a undefined
  </code></pre>
  <p>What's wrong with the way I am using <code>eval()</code> here?</p>