You're trying to instantiate your class (so that it gets a this
and its prototype
).
To do that, you need the new
keyword.
However, you can't combine that directly with require; otherwise, it will be parsed as
(new require('./../routing').router()
(calling require()
as a constructor)
Instead, you need to wrap the entire function expression in parentheses:
new (require('./../routing').router)()
Or, better yet,
var Router = require('./../routing').router;
var router = new Router();