forked from hibas123/ScreenSharingThing
add some https for testing porpurses
This commit is contained in:
14
src/index.ts
14
src/index.ts
@ -1,11 +1,23 @@
|
||||
import { ExpressPeerServer } from "peer";
|
||||
import * as express from "express";
|
||||
import * as fs from "fs";
|
||||
import * as https from "https";
|
||||
import * as path from "path";
|
||||
|
||||
|
||||
const cert = fs.readFileSync(path.resolve(__dirname, "../cert/selfsigned.crt"), 'utf8');
|
||||
const key = fs.readFileSync(path.resolve(__dirname, "../cert/selfsigned.key"), 'utf8');
|
||||
var credentials = { key: key, cert: cert };
|
||||
|
||||
const app = express();
|
||||
const server = app.listen(3000);
|
||||
const https_server = https.createServer(credentials,app)
|
||||
|
||||
let server = https_server.listen(8001);
|
||||
const peerServer = ExpressPeerServer(server, {
|
||||
path: "/",
|
||||
});
|
||||
console.log("Started server!")
|
||||
|
||||
|
||||
app.use("/peerjs", peerServer as any);
|
||||
app.use("/", express.static("public"));
|
||||
|
Reference in New Issue
Block a user