| 
									
										
										
										
											2016-08-16 13:05:41 -04:00
										 |  |  | 'use strict'; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-01-25 15:02:16 -07:00
										 |  |  | //require('greenlock-express')
 | 
					
						
							| 
									
										
										
										
											2016-08-16 13:05:41 -04:00
										 |  |  | require('../').create({ | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-04-20 04:18:34 +00:00
										 |  |  |   // Let's Encrypt v2 is ACME draft 11
 | 
					
						
							|  |  |  |   version: 'draft-11' | 
					
						
							| 
									
										
										
										
											2016-08-16 13:05:41 -04:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-04-20 04:18:34 +00:00
										 |  |  |   // You MUST change 'acme-staging-v02' to 'acme-v02' in production
 | 
					
						
							|  |  |  | , server: 'https://acme-staging-v02.api.letsencrypt.org/directory'  // staging
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   // You MUST change this to a valid email address
 | 
					
						
							| 
									
										
										
										
											2016-08-16 11:26:54 -06:00
										 |  |  | , email: 'john.doe@example.com' | 
					
						
							| 
									
										
										
										
											2016-08-16 13:05:41 -04:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-04-20 04:18:34 +00:00
										 |  |  |   // You MUST NOT build clients that accept the ToS without asking the user
 | 
					
						
							| 
									
										
										
										
											2016-08-16 13:05:41 -04:00
										 |  |  | , agreeTos: true | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-04-20 04:18:34 +00:00
										 |  |  |   // You MUST change these to valid domains
 | 
					
						
							|  |  |  |   // NOTE: all domains will validated and listed on the certificate
 | 
					
						
							|  |  |  | , approveDomains: [ 'example.com', 'www.example.com' ] | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   // You MUST have access to write to directory where certs are saved
 | 
					
						
							|  |  |  |   // ex: /home/foouser/acme/etc
 | 
					
						
							|  |  |  | , configDir: require('path').join(require('os').homedir(), 'acme', 'etc') | 
					
						
							| 
									
										
										
										
											2016-08-16 13:05:41 -04:00
										 |  |  | 
 | 
					
						
							|  |  |  | , app: require('express')().use('/', function (req, res) { | 
					
						
							| 
									
										
										
										
											2018-04-20 04:18:34 +00:00
										 |  |  |     res.setHeader('Content-Type', 'text/html; charset=utf-8') | 
					
						
							|  |  |  |     res.end('Hello, World!\n\n💚 🔒.js'); | 
					
						
							| 
									
										
										
										
											2016-08-16 13:05:41 -04:00
										 |  |  |   }) | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-04-20 04:18:34 +00:00
										 |  |  | //, debug: true
 | 
					
						
							| 
									
										
										
										
											2016-08-16 13:05:41 -04:00
										 |  |  | 
 | 
					
						
							|  |  |  | }).listen(80, 443); |