File tree Expand file tree Collapse file tree 1 file changed +37
-0
lines changed Expand file tree Collapse file tree 1 file changed +37
-0
lines changed Original file line number Diff line number Diff line change
1
+ 'use strict'
2
+
3
+ const gateway = require ( '../index' )
4
+ const PORT = process . env . PORT || 8080
5
+ const http = require ( 'http' )
6
+ const restana = require ( 'restana' )
7
+
8
+ const hostnames2prefix = [ {
9
+ prefix : '/public' ,
10
+ hostname : 'nodejs.org'
11
+ } ]
12
+ const hostnamesHook = require ( './../lib/hostnames-hook' ) ( hostnames2prefix )
13
+
14
+ const app = restana ( )
15
+ const server = http . createServer ( ( req , res ) => {
16
+ hostnamesHook ( req , res , ( ) => {
17
+ return app ( req , res )
18
+ } )
19
+ } )
20
+
21
+ gateway ( {
22
+ server : app ,
23
+ middlewares : [
24
+ ] ,
25
+
26
+ routes : [ {
27
+ prefix : '/public' ,
28
+ target : 'http://localhost:3000'
29
+ } ]
30
+ } )
31
+
32
+ server . listen ( PORT )
33
+
34
+ const origin = require ( 'restana' ) ( { } )
35
+ origin
36
+ . get ( '/hi' , ( req , res ) => res . send ( 'Hello World!' ) )
37
+ . start ( 3000 )
You can’t perform that action at this time.
0 commit comments