greenlock-express.js/single.js

39 lines
903 B
JavaScript

"use strict";
require("./main.js");
var Single = module.exports;
var Servers = require("./servers.js");
Single.create = function(opts) {
var greenlock = require("./greenlock-shim.js").create(opts);
var servers = Servers.create(greenlock);
var single = {
ready: function(fn) {
fn(servers);
return single;
},
master: function(/*fn*/) {
// ignore
//fn(master);
return single;
},
serve: function(fn) {
// keeping backwards compat
if (1 === fn.length) {
single.ready(fn);
return;
}
// serving the app, right away
single.ready(function(glx) {
glx.serveApp(fn);
});
}
};
// backwards compat starts now
single.serve = single.ready;
return single;
};