From the course: React: Software Architecture

Unlock the full course today

Join today to access over 24,700 courses taught by industry experts.

Basic React SSR

Basic React SSR

- Okay, so now that we have our very simple blog application, what we're going to do, is start adding some server-side rendering to it. So, the first step in all of this, is that we have to create a server file that will actually run, listen for requests and render and serve our app. So, let's create a new file in the outermost directory of our project here, and we're going to call it server.js. Now, this is going to be a basic express server, and we'll want to write it in the same JavaScript syntax that we write our front-end in, right? Since it's going to be essentially, running our front-end code. So, in order to do both of those things, we need to install a few packages. The first thing we're going to do is say, npm install --save-dev, and we're going to install some packages from babel that will basically take the modern code that we write, such as in react, as well as on the server itself. And, basically…

Contents