Update README.md
This commit is contained in:
		
							parent
							
								
									98db5e1d04
								
							
						
					
					
						commit
						160bc1ff0f
					
				
							
								
								
									
										14
									
								
								README.md
									
									
									
									
									
								
							
							
						
						
									
										14
									
								
								README.md
									
									
									
									
									
								
							| @ -240,21 +240,19 @@ function getAppContext(domain) { | |||||||
| 
 | 
 | ||||||
|   // But for this demo we'll do this: |   // But for this demo we'll do this: | ||||||
|   return connect().use('/', function (req, res) { |   return connect().use('/', function (req, res) { | ||||||
|  |     console.log('req.vhost', JSON.stringify(req.vhost)); | ||||||
|     res.end('<html><body><h1>Welcome to ' + domain + '!</h1></body></html>'); |     res.end('<html><body><h1>Welcome to ' + domain + '!</h1></body></html>'); | ||||||
|   }); |   }); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| 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' | [ 'aj.the.dj' | ||||||
| , 'ballprovo.com' | , 'ballprovo.com' | ||||||
| ].forEach(function (domain) { | ].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))); | ||||||
|   app.use(vhost(domain, getAppContext(domain))); |   app.use(vhost(domain, getAppContext(domain))); | ||||||
| }); | }); | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user