Skip to content

Commit 838e0e3

Browse files
Rolando Santamaria MasoRolando Santamaria Maso
authored andcommitted
adding inline documentation
1 parent a4ad076 commit 838e0e3

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

demos/basic-hostnames.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,21 +5,25 @@ const PORT = process.env.PORT || 8080
55
const http = require('http')
66
const restana = require('restana')
77

8+
// binding hostnames to prefixes
89
const hostnames2prefix = [{
910
prefix: '/public',
1011
hostname: 'nodejs.org'
1112
}]
13+
// instantiate hostnames hook, this will prefix request urls according to data in hostnames2prefix
1214
const hostnamesHook = require('./../lib/hostnames-hook')(hostnames2prefix)
1315

16+
// separately instantiate and configure restana application
1417
const app = restana()
1518
const server = http.createServer((req, res) => {
1619
hostnamesHook(req, res, () => {
1720
return app(req, res)
1821
})
1922
})
2023

24+
// gateway configuration
2125
gateway({
22-
server: app,
26+
server: app, // injecting existing restana application
2327
middlewares: [
2428
],
2529

0 commit comments

Comments
 (0)