Something went wrong. Try again.
プレイグラウンド、サンドボックス、使い捨てスクリプト置き場
Something went wrong. Try again.
1234567891011121314151617181920// @ts-checkconst path = require("path");const app = require("express")();const http = require("http").createServer(app);const io = require("socket.io")(http);
const port = Number(process.env.PORT) || 8080;
app.get("/", function(_, res) { res.sendFile(path.join(__dirname, "public", "index.html"));});
http.listen(port, function() { console.log(`listening on http://localhost:${port}`);});
io.on("connect", socket => { socket.on("message", message => io.send(message));});