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

Popular posts from this blog

routing - AngularJS State management ->load multiple states in one page -

python - GRASS parser() error -

Swift game error message -