1// npm i socket.io
2const http = require('http')
3const express = require('express')
4const socketio = require('socket.io')
5
6const app = express()
7const server = http.createServer(app)
8const io = socketio(server)
9
10const port = process.env.PORT || 3000
11
12server.listen(port, () => {
13 console.log(`Server is up on port ${port}!`)
14})
1const express = require("express");
2const http = require("http");
3const socketIo = require("socket.io");
4const port = process.env.PORT || 8001;
5const index = require("./routes/index");
6const app = express();
7app.use(index);
8const server = http.createServer(app);
9const io = socketIo(server); // < Interesting!
10const getApiAndEmit = "TODO";