【webrtc】web服务(8)
'use strict';
var http = require('http');
var https = require('https');
var fs = require('fs');//读取证书
var express = require('express');
var serveIndex = require('serve-index')
var app = express();//实例化express模块
app.use(serveIndex('./public'));//浏览目录
app.use(express.static('./public'));//发布静态目录的位置;发布路径
//http server服务创建
var http_server = http.createServer(app);
http_server.listen(8080, '0.0.0.0');
//创建http server
var options = {
key : fs.readFileSync('./cert/1557605_www.learningrtc.cn.key'),
cert: fs.readFileSync('./cert/1557605_www.learningrtc.cn.pem')
}
var https_server = https.createServer(options, app);
https_server.listen(9999, '0.0.0.0');
示例github地址
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】凌霞软件回馈社区,博客园 & 1Panel & Halo 联合会员上线
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步