const express = require("express"); const socket = require("socket.io"); // App setup const app = express(); const server = app.listen(5000, function () { console.log(`server running!`); }); // Static files app.use(express.static("public")); // Socket setup const io = socket(server); io.on("connection", function (socket) { console.log("socket connection on"); });
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter