我正在尝试使用Express 4.x在HTTPS中启动服务器。我试过了
var credentials = {key: privateKey, cert: certificate};
var app = express(credentials);
但它不起作用。
答案 0 :(得分:14)
您可以轻松地执行以下操作:
var app = express(),
credentials = {key: privateKey, cert: certificate},
server = https.createServer(credentials, app);
server.listen(8443);