greenlock-express.js/demo.js

36 lines
720 B
JavaScript
Raw Normal View History

2019-10-27 05:52:19 +00:00
"use strict";
2019-10-28 07:06:43 +00:00
require("./")
2019-11-01 21:14:07 +00:00
.init(initialize)
.serve(worker)
.master(function() {
console.log("Hello from master");
});
2019-10-27 05:52:19 +00:00
2019-10-28 07:06:43 +00:00
function initialize() {
2019-11-01 21:14:07 +00:00
var pkg = require("./package.json");
var config = {
package: {
name: "Greenlock_Express_Demo",
version: pkg.version,
author: pkg.author
},
staging: true,
cluster: true,
2019-10-27 05:52:19 +00:00
2019-11-01 21:14:07 +00:00
notify: function(ev, params) {
console.info(ev, params);
}
};
return config;
2019-10-28 07:06:43 +00:00
}
2019-10-27 05:52:19 +00:00
2019-10-28 07:06:43 +00:00
function worker(glx) {
2019-11-01 21:14:07 +00:00
console.info();
console.info("Hello from worker #" + glx.id());
2019-10-27 05:52:19 +00:00
2019-11-01 21:14:07 +00:00
glx.serveApp(function(req, res) {
res.end("Hello, Encrypted World!");
});
2019-10-28 07:06:43 +00:00
}