on second thought, just the node app example

This commit is contained in:
AJ ONeal 2019-11-01 04:19:32 -06:00
parent fceeb8c72c
commit fff5192fb4
1 changed files with 11 additions and 32 deletions

View File

@ -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)