关于使用koa实现线上 https服务

2022-06-14 20:03:27 浏览数 (1)

代码语言:javascript复制
var https=require(“https”);//https服务
var fs= require(“fs”);
var Koa = require(‘koa’);
var enforceHttps = require(‘koa-sslify’).default;
var app = new Koa();
app.use(enforceHttps());
var options = {
key: fs.readFileSync(’./2_xxx.key’),
cert: fs.readFileSync(’./1_xxx_bundle.crt’)
}

https.createServer(options, app.callback()).listen(5300); console.log(‘服务器运行中’)

更多内容请见原文,原文转载自:https://blog.csdn.net/weixin_44519496/article/details/119816354

0 人点赞