Skip to content

Commit 90a5c66

Browse files
committed
supporting custom restana initialization
1 parent dede67c commit 90a5c66

File tree

2 files changed

+2
-1
lines changed

2 files changed

+2
-1
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ service.start(3000)
3636
```js
3737
{
3838
// Optional restana library configuration (https://www.npmjs.com/package/restana#configuration)
39+
// If the given value is a function instead of an object, it will be considered a restana service factory.
3940
restana: {},
4041
// Optional global middlewares in the format: (req, res, next) => next()
4142
// Default value: []

index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ const gateway = (opts) => {
1010
pathRegex: '/*'
1111
}, opts)
1212

13-
const server = restana(opts.restana || {
13+
const server = (opts.restana instanceof Function) ? opts.restana() : restana(opts.restana || {
1414
disableResponseEvent: true
1515
})
1616

0 commit comments

Comments
 (0)