Skip to content

Commit 8dc9e4b

Browse files
authored
Merge pull request #65 from jkyberneees/fix-method-chaining
Fix method chaining
2 parents af231ee + 8502267 commit 8dc9e4b

File tree

3 files changed

+12
-4
lines changed

3 files changed

+12
-4
lines changed

index.js

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,11 @@ module.exports = (options = {}) => {
4646
return options
4747
},
4848

49-
use: router.use,
49+
use: (...args) => {
50+
router.use.apply(router, args)
51+
52+
return app
53+
},
5054

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

7478
shortcuts.forEach((method) => {
75-
app[method] = router[method]
79+
app[method] = (...args) => {
80+
router[method].apply(router, args)
81+
82+
return app
83+
}
7684
})
7785

7886
app.callback = () => app.handle

package-lock.json

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "restana",
3-
"version": "4.0.0",
3+
"version": "4.0.1",
44
"description": "Super fast and minimalist web framework for building REST micro-services.",
55
"main": "index.js",
66
"types": "index.d.ts",

0 commit comments

Comments
 (0)