审核中~
溜忙之道
首页
溜忙手册
offer之道
项目Git
写文章
登录
·
注册
登录
没有账号,去注册
注册
已有账号,去登录
博客
# Nodejs配置Https服务
南易_站长
阅读量:5474
关注
# Nodejs配置Https服务
将证书文件放在自己`Node`项目中的某个文件夹中,这里放在根目录下的`https`文件下 ```javascript let express = require("express"); let http = require("http"); let https = require("https"); let fs = require("fs"); // Configuare https const httpsOption = { key : fs.readFileSync("./https/xxxxxxxxxxxx.key"), cert: fs.readFileSync("./https/xxxxxxxxxxxx.pem") } // Create service let app = express(); http.createServer(app).listen(80); https.createServer(httpsOption, app).listen(443); ```
评论
表情
发送
0
评论