title: Nodejs, express routes as es6 classes
body: <p>I want to clean up my project a bit and now i try to use es6 classes for my routes. My problem is that <strong>this</strong> is always undefined.</p>
  
  <pre><code>var express = require('express');
  var app = express();
  
  class Routes {
      constructor(){
          this.foo = 10
      }
  
      Root(req, res, next){
          res.json({foo: this.foo}); // TypeError: Cannot read property 'foo' of undefined
      }
  }
  
  var routes = new Routes();
  app.get('/', routes.Root);
  app.listen(8080);
  </code></pre>