mirror of
				https://github.com/therootcompany/greenlock-express.js.git
				synced 2024-11-16 17:28:59 +00:00 
			
		
		
		
	on second thought, just the node app example
This commit is contained in:
		
							parent
							
								
									fceeb8c72c
								
							
						
					
					
						commit
						fff5192fb4
					
				
							
								
								
									
										43
									
								
								README.md
									
									
									
									
									
								
							
							
						
						
									
										43
									
								
								README.md
									
									
									
									
									
								
							| @ -19,8 +19,18 @@ Free SSL, Automated HTTPS / HTTP2, served with Node via Express, Koa, hapi, etc. | |||||||
| Greenlock Express is a **Web Server** with **Fully Automated HTTPS** and renewals. | Greenlock Express is a **Web Server** with **Fully Automated HTTPS** and renewals. | ||||||
| 
 | 
 | ||||||
| ```js | ```js | ||||||
| var pkg = require("./package.json"); | "use strict"; | ||||||
| 
 | 
 | ||||||
|  | function httpsWorker(glx) { | ||||||
|  | 	// Serves on 80 and 443 | ||||||
|  | 	// Get's SSL certificates magically! | ||||||
|  | 
 | ||||||
|  | 	glx.serveApp(function(req, res) { | ||||||
|  | 		res.end("Hello, Encrypted World!"); | ||||||
|  | 	}); | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | var pkg = require("./package.json"); | ||||||
| require("greenlock-express") | require("greenlock-express") | ||||||
| 	.init(function getConfig() { | 	.init(function getConfig() { | ||||||
| 		// Greenlock Config | 		// Greenlock Config | ||||||
| @ -34,37 +44,6 @@ require("greenlock-express") | |||||||
| 	.serve(httpsWorker); | 	.serve(httpsWorker); | ||||||
| ``` | ``` | ||||||
| 
 | 
 | ||||||
| With **Express**: |  | ||||||
| 
 |  | ||||||
| ```js |  | ||||||
| function httpsWorker(glx) { |  | ||||||
| 	// Works with any Node app (Express, etc) |  | ||||||
| 	var app = require("./my-express-app.js"); |  | ||||||
| 
 |  | ||||||
| 	// See, all normal stuff here |  | ||||||
| 	app.get("/hello", function(req, res) { |  | ||||||
| 		res.end("Hello, Encrypted World!"); |  | ||||||
| 	}); |  | ||||||
| 
 |  | ||||||
| 	// Serves on 80 and 443 |  | ||||||
| 	// Get's SSL certificates magically! |  | ||||||
| 	glx.serveApp(app); |  | ||||||
| } |  | ||||||
| ``` |  | ||||||
| 
 |  | ||||||
| Or with **plain** node HTTP: |  | ||||||
| 
 |  | ||||||
| ```js |  | ||||||
| function httpsWorker(glx) { |  | ||||||
| 	// Serves on 80 and 443 |  | ||||||
| 	// Get's SSL certificates magically! |  | ||||||
| 
 |  | ||||||
| 	glx.serveApp(function(req, res) { |  | ||||||
| 		res.end("Hello, Encrypted World!"); |  | ||||||
| 	}); |  | ||||||
| } |  | ||||||
| ``` |  | ||||||
| 
 |  | ||||||
| Manage via API or the config file: | Manage via API or the config file: | ||||||
| 
 | 
 | ||||||
| `~/.config/greenlock/manage.json`: (default filesystem config) | `~/.config/greenlock/manage.json`: (default filesystem config) | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user