diff --git a/app.js b/app.js index 9f015c9..8bf2b52 100644 --- a/app.js +++ b/app.js @@ -3,36 +3,20 @@ */ require('dotenv').config() + const express = require('express'); const app = express(); const Server = require('socket.io'); const path = require('node:path'); const fs = require('node:fs'); -let https; -try { - https = require('node:https'); -} catch (err) { - console.log('https support is disabled!'); -} +let https = require('https');; +// try { +// https = require('node:https'); +// } catch (err) { +// console.log('https support is disabled!'); +// } const mediasoup = require('mediasoup'); -/* Please follow mediasoup installation requirements */ -/* https://mediasoup.org/documentation/v3/mediasoup/installation/ */ -// import express from 'express' -// const app = express() -// const app = require('express')(); -// import https from 'httpolyglot' -// import https from "https"; -// import fs from 'fs' -// import path from 'path' - - -// import Server from 'socket.io' -// import mediasoup from 'mediasoup' -// import * as https from "http"; -// import Server from "socket.io"; -// import middleware from 'socketio-wildcard' -// const app = express.default(); let worker /** @@ -71,9 +55,9 @@ const options = { // const io = new Server(httpsServer, { allowEIO3: true }); const httpsServer = https.createServer(options, app); -app.get('/', (req, res) => { - res.send('Now using https..'); -}); +httpsServer.listen(process.env.PORT, () => { + console.log('Listening on port:', process.env.PORT) +}) const io = new Server(httpsServer, { allowRequest: (req) => { @@ -86,10 +70,6 @@ const io = new Server(httpsServer, { // io.use(middleware); // const httpsServer = https.createServer(options, app) -httpsServer.listen(process.env.PORT, () => { - console.log('Listening on port:', process.env.PORT) -}) - // const io = new Server(httpsServer, { // allowEIO3: true // });