Skip to content

Commit f6cfd1e

Browse files
authored
Merge pull request #20 from jkyberneees/support-restana-server-factory
Support custom restana initialization
2 parents dede67c + c34b3f0 commit f6cfd1e

File tree

4 files changed

+8
-7
lines changed

4 files changed

+8
-7
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

package-lock.json

Lines changed: 4 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "fast-gateway",
3-
"version": "1.4.0",
3+
"version": "1.5.0",
44
"description": "A Node.js API Gateway for the masses!",
55
"main": "index.js",
66
"scripts": {
@@ -28,7 +28,7 @@
2828
"dependencies": {
2929
"fast-proxy": "^1.3.0",
3030
"http-cache-middleware": "^1.2.3",
31-
"restana": "^3.3.3",
31+
"restana": "^3.4.0",
3232
"stream-to-array": "^2.3.0"
3333
},
3434
"devDependencies": {

0 commit comments

Comments
 (0)