sandy98 / node-simple-router

Yet another minimalistic router for node.js
node-simple-router.herokuapp.com
MIT License
36 stars 18 forks source link

How to call function in router.js #17

Open yinxufeng opened 9 years ago

yinxufeng commented 9 years ago

See: var router = new Router({logging: true, static_route: __dirname}); router.get("/", router.dispatch._404); I don't want to the path "/" list dirs, but orther path still normal. I saw the function “dispatch._404” in router.js。I want to call directly,but mistake: TypeError: Cannot read property '_404' of undefined

help!

finwo commented 7 years ago

After some experimenting, I found functions like _404 to be assigned directly on the router object.

For example:

> console.log( typeof router._404 );
< "function"