Alternatively, you may want to use a module called nodemon to automatically do this whenever any changes are made.
Run the following inside of your Terminal:
# Install nodemon globally$ npm install nodemon -g
We can then run:
# Listen for any changes to our server.js file and restart the server$ nodemon server.js
Great! Let's go back to our MessageForm component and create the sendMessage function:
methods: { sendMessage() { this.socket.emit('chatMessage', { username: this.username, message: this.message, }); },},
At this point hitting Send doesn't add the message to an array yet, but it does give us the sent message inside of our ...