Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
pend.wait(function() {
self.httpServer = https.createServer(options, self.app);
cb();
});
}
function httpsListener(listener) {
var server = https.createServer({
key: fs.readFileSync(path.resolve(listener.key)),
cert: fs.readFileSync(path.resolve(listener.cert))
}, app);
server.listen(listener.port, listener.listen, postStartup);
}
return loadKeyCert(sslKey, sslCert, function (err, credentials) {
if (err) {
return done(err);
}
result.sslPort = sslPort;
result.httpsServer = https.createServer(credentials, result.app);
result.httpsServer.on("listening", done);
result.httpsServer.on("error", function (err) {
return logger.error("https server error", err);
});
result.httpsServer.listen(sslPort);
return done();
});
});
.then(() => {
let server;
let scheme;
if (httpsCredentials) {
server = https.createServer(httpsCredentials, app);
scheme = "https";
} else {
server = http.createServer(app);
scheme = "http";
}
server.listen(config.port);
mozlog.info("server-started", {
msg: `server listening on ${scheme}://localhost:${config.port}/`
});
})
.catch(err => {