First up, we'll load in the http module. So, let's make a constant called http, which is a built-in Node module so there's no need to install it. We can simply enter require('http'), just like this:
const path = require('path');const http = require('http');const express = require('express');const socketIO = require('socket.io');
From here, we'll create a server using this http library. Just below our app variable, let's make a variable called server. We'll call http.createServer:
const path = require('path');const http = require('http');const express = require('express');const socketIO = require('socket.io');const publicPath = path.join(_dirname, '../public');const port = process.env.PORT || 3000; ...