The first step in this process will be to import the function we just created. I'm going to do that creating a constant in server.js. We'll use ES6 destructuring to grab generateMessage, and we're going to grab it off of a call to require. Now we're requiring a local file in a different directory. We're going to start with ./, go into the utils directory since we're currently in the server directory, and then grab the file message by specifying it:
const socketIO = require('socket.io');const {generateMessage} = require('./utils/message');
Now we have access to generateMessage, and instead of creating these objects we can call generateMessage. In socket.emit, we're going to replace Welcome ...