Newer
Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
import express from "express"
import http from "http"
import signalbuddy from "signalbuddy"
const port = process.env.PORT || 3000
const app = express()
const server = http.createServer(app)
const config = {
rooms: {
maxClients: 0, // no limit
},
stunCount: 2,
turnCount: 0,
}
signalbuddy(server, config)
app.use(
"/",
express.static("public", {
setHeaders: (_response, file_path) => {
// Log access
console.log(Date.now(), file_path, "accessed")
},
}),
)
server.listen(port, () => {
const host = server.address().address
const port = server.address().port
console.log("Started server on %s, port: %s", host, port)
console.log("Static file server: %s\n", `http://${host}:${port}/`)
})