javascript - Extending express.Router -
is there way extend express.router ?
i tried :
class test extends express.routeur() { }; but express throws me error.
any solution ?
the right way it:
class test extends express.router { constructor() { super(); this.get('/', (req, res) => console.log('test')); } }; when write express.router() (with parentheses) call constructor , therefore you're trying extend object instead of class.
Comments
Post a Comment