| 
									
										
										
										
											2019-11-01 04:12:40 -06:00
										 |  |  | "use strict"; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | function httpsWorker(glx) { | 
					
						
							| 
									
										
										
										
											2019-11-01 15:14:07 -06:00
										 |  |  |     // This can be a node http app (shown),
 | 
					
						
							|  |  |  |     // an Express app, or Hapi, Koa, Rill, etc
 | 
					
						
							|  |  |  |     var app = function(req, res) { | 
					
						
							|  |  |  |         res.end("Hello, Encrypted World!"); | 
					
						
							|  |  |  |     }; | 
					
						
							| 
									
										
										
										
											2019-11-01 04:12:40 -06:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-11-01 15:14:07 -06:00
										 |  |  |     // Serves on 80 and 443
 | 
					
						
							|  |  |  |     // Get's SSL certificates magically!
 | 
					
						
							|  |  |  |     glx.serveApp(app); | 
					
						
							| 
									
										
										
										
											2019-11-01 04:12:40 -06:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | var pkg = require("../../package.json"); | 
					
						
							|  |  |  | //require("greenlock-express")
 | 
					
						
							|  |  |  | require("../../") | 
					
						
							| 
									
										
										
										
											2019-11-01 15:14:07 -06:00
										 |  |  |     .init(function getConfig() { | 
					
						
							|  |  |  |         // Greenlock Config
 | 
					
						
							| 
									
										
										
										
											2019-11-01 04:12:40 -06:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-11-01 15:14:07 -06:00
										 |  |  |         return { | 
					
						
							|  |  |  |             // Package name+version is used for ACME client user agent
 | 
					
						
							|  |  |  |             package: { name: "websocket-example", version: pkg.version }, | 
					
						
							| 
									
										
										
										
											2019-11-01 04:12:40 -06:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-11-01 15:14:07 -06:00
										 |  |  |             // Maintainer email is the contact for critical bug and security notices
 | 
					
						
							|  |  |  |             maintainerEmail: "jon@example.com", | 
					
						
							| 
									
										
										
										
											2019-11-01 04:12:40 -06:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-11-01 15:14:07 -06:00
										 |  |  |             // Change to true when you're ready to make your app cloud-scale
 | 
					
						
							|  |  |  |             cluster: false | 
					
						
							|  |  |  |         }; | 
					
						
							|  |  |  |     }) | 
					
						
							|  |  |  |     .serve(httpsWorker); |