greenlock-express.js/examples/express/server.js

28 lines
638 B
JavaScript
Raw Normal View History

2019-11-01 10:12:40 +00:00
"use strict";
function httpsWorker(glx) {
2019-11-01 21:14:07 +00:00
var app = require("./my-express-app.js");
2019-11-01 10:12:40 +00:00
2019-11-01 21:14:07 +00:00
app.get("/hello", function(req, res) {
res.end("Hello, Encrypted World!");
});
2019-11-01 10:12:40 +00:00
2019-11-01 21:14:07 +00:00
// Serves on 80 and 443
// Get's SSL certificates magically!
glx.serveApp(app);
2019-11-01 10:12:40 +00:00
}
var pkg = require("../../package.json");
//require("greenlock-express")
require("../../")
2019-11-01 21:14:07 +00:00
.init(function getConfig() {
// Greenlock Config
2019-11-01 10:12:40 +00:00
2019-11-01 21:14:07 +00:00
return {
package: { name: "http2-example", version: pkg.version },
maintainerEmail: "jon@example.com",
cluster: false
};
})
.serve(httpsWorker);