File tree Expand file tree Collapse file tree 1 file changed +5
-1
lines changed Expand file tree Collapse file tree 1 file changed +5
-1
lines changed Original file line number Diff line number Diff line change @@ -5,21 +5,25 @@ const PORT = process.env.PORT || 8080
5
5
const http = require ( 'http' )
6
6
const restana = require ( 'restana' )
7
7
8
+ // binding hostnames to prefixes
8
9
const hostnames2prefix = [ {
9
10
prefix : '/public' ,
10
11
hostname : 'nodejs.org'
11
12
} ]
13
+ // instantiate hostnames hook, this will prefix request urls according to data in hostnames2prefix
12
14
const hostnamesHook = require ( './../lib/hostnames-hook' ) ( hostnames2prefix )
13
15
16
+ // separately instantiate and configure restana application
14
17
const app = restana ( )
15
18
const server = http . createServer ( ( req , res ) => {
16
19
hostnamesHook ( req , res , ( ) => {
17
20
return app ( req , res )
18
21
} )
19
22
} )
20
23
24
+ // gateway configuration
21
25
gateway ( {
22
- server : app ,
26
+ server : app , // injecting existing restana application
23
27
middlewares : [
24
28
] ,
25
29
You can’t perform that action at this time.
0 commit comments