Skip to content

Commit

Permalink
fixes method chaining for use and routes
Browse files Browse the repository at this point in the history
  • Loading branch information
jkyberneees committed Jan 2, 2020
1 parent b647012 commit 8502267
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,11 @@ module.exports = (options = {}) => {
return options
},

use: router.use,
use: (...args) => {
router.use.apply(router, args)

return app
},

handle: (req, res) => {
// request object population
Expand All @@ -72,7 +76,11 @@ module.exports = (options = {}) => {
}

shortcuts.forEach((method) => {
app[method] = router[method]
app[method] = (...args) => {
router[method].apply(router, args)

return app
}
})

app.callback = () => app.handle
Expand Down

0 comments on commit 8502267

Please sign in to comment.