
To begin the live server, ensure you basically have an HTML created. I use Live Server by Ritwick Dey, so let’s continue with that one in this example:Ĭlick on the install button and it will install the extension. You will see many options, so you can choose whichever one works for your system. When you click on it a search bar will show up.

In the syncUpdates() method, we’re making a request to the /update-editor route that was created earlier. In the class constructor, we initialized the Pusher client library and subscribed to the editor channel.

Once the dependencies have been installed, create a new server.js file in the root of your project directory and paste in the following code: // server.js require ( 'dotenv' ). Next, install the dependencies we’ll be using to set up the Node server: npm install express body -parser dotenv cors pusher -save The -y flag allows us to accept all the defaults without being prompted. Next, initialize a new Node project by running the command below. Set up the serverĬreate a new directory for this project on your machine and cd into it: mkdir code -playground


Installation instructions for Node.js can be found on this page. You also need to have Node.js (version 6 or later) and npm installed on your machine. You need to have experience with building React and Node.js applications to follow through with this tutorial. You can find the entire source code for the application in this GitHub repository. In this tutorial, we’ll go through how to build a code editor with React, while syncing the changes made in realtime across all connected clients with Pusher Channels. You will need Node 6+ installed on your machine.
