From 160bc1ff0f2ec50acffe29cea4f6753f712fbd29 Mon Sep 17 00:00:00 2001 From: AJ ONeal Date: Wed, 25 Jun 2014 20:04:52 -0600 Subject: [PATCH] Update README.md --- README.md | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index 88ec3c5..e8c3717 100644 --- a/README.md +++ b/README.md @@ -240,21 +240,19 @@ function getAppContext(domain) { // But for this demo we'll do this: return connect().use('/', function (req, res) { + console.log('req.vhost', JSON.stringify(req.vhost)); res.end('

Welcome to ' + domain + '!

'); }); } -function getSecureContext(domain) { - return crypto.createCredentials({ - key: fs.readFileSync(__dirname + '/' + domain + '/ssl/server.key') - , cert: fs.readFileSync(__dirname + '/' + domain + '/ssl/server.crt') - }).context; -} - [ 'aj.the.dj' , 'ballprovo.com' ].forEach(function (domain) { - secureContexts[domain] = getSecureContext(domain); + secureContexts[domain] = crypto.createCredentials({ + key: fs.readFileSync(__dirname + '/' + domain + '/ssl/server.key') + , cert: fs.readFileSync(__dirname + '/' + domain + '/ssl/server.crt') + }).context; + app.use(vhost('*.' + domain, getAppContext(domain))); app.use(vhost(domain, getAppContext(domain))); });