Skip to content

Commit

Permalink
Merge pull request #65 from jkyberneees/fix-method-chaining
Browse files Browse the repository at this point in the history
Fix method chaining
  • Loading branch information
jkyberneees authored Jan 2, 2020
2 parents af231ee + 8502267 commit 8dc9e4b
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 4 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
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "restana",
"version": "4.0.0",
"version": "4.0.1",
"description": "Super fast and minimalist web framework for building REST micro-services.",
"main": "index.js",
"types": "index.d.ts",
Expand Down

0 comments on commit 8dc9e4b

Please sign in to comment.