UNPKG

@cocalc/hub

Version:
27 lines 932 B
"use strict"; // The HTTP(S) server, which makes the other servers // (websocket, proxy, and share) available on the network. Object.defineProperty(exports, "__esModule", { value: true }); const fs_1 = require("fs"); const logger_1 = require("../logger"); const https_1 = require("https"); const http_1 = require("http"); function init({ cert, key, app }) { const winston = (0, logger_1.getLogger)("init-http-server"); if (key || cert) { if (!key || !cert) { throw Error("specify *both* key and cert or neither"); } winston.info("Creating HTTPS server..."); return (0, https_1.createServer)({ cert: (0, fs_1.readFileSync)(cert), key: (0, fs_1.readFileSync)(key), }, app); } else { winston.info("Creating HTTP server..."); return (0, http_1.createServer)(app); } } exports.default = init; //# sourceMappingURL=http.js.map