代码拉取完成,页面将自动刷新
const express = require("express");
const path = require("path");
const http = require("http");
const app = express();
const server = http.createServer(app);
const io = require("socket.io")(server, {
cors: { origin: process.env.CORS_ORIGIN ? process.env.CORS_ORIGIN.split(",") : "*" },
});
const signallingServer = require("./server/signalling-server.js");
// Get PORT from env variable else assign 3000 for development
const PORT = process.env.PORT || 3000;
// Server all the static files from www folder
app.use(express.static(path.join(__dirname, "www")));
app.use(express.static(path.join(__dirname, "icons")));
app.use(express.static(path.join(__dirname, "assets")));
app.use(express.static(path.join(__dirname, "node_modules/vue/dist/")));
server.listen(PORT, null, () => {
console.log("Talk server started");
console.log({ port: PORT, node_version: process.versions.node });
});
// serve the landing page
app.get("/", (req, res) => res.sendFile(path.join(__dirname, "www/index.html")));
// serve the terms / legal page
app.get("/legal", (req, res) => res.sendFile(path.join(__dirname, "www/legal.html")));
// All other URL patterns will serve the app.
app.get("/:room", (req, res) => res.sendFile(path.join(__dirname, "www/app.html")));
io.sockets.on("connection", signallingServer);
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。