import { ExpressPeerServer } from "peer";
import express = require("express");
import * as path from "path";

const app = express();

const server = app.listen(5000, () => {
   console.log("Server is running on port 5000");
});

const peerServer = ExpressPeerServer(server, {
   path: "/",
});


app.use("/peerjs", peerServer as any);
app.use("/", express.static("public"));

app.get('*', (req, res) => {
   res.sendFile(path.resolve(__dirname, "..", "public", "index.html"));
});
