From the course: React: Server-Side Rendering

Unlock the full course today

Join today to access over 22,600 courses taught by industry experts or purchase this course individually.

Add the Express routes

Add the Express routes - React.js Tutorial

From the course: React: Server-Side Rendering

Start my 1-month free trial

Add the Express routes

- [Instructor] Okay, so right now our server is running okay. But if you load it into the browser, it says cannot get. This is because we don't have an express met calling a route. So let's work on that. So I'm going to go back into visuals studio code and we can close the terminal. And what I'm going to do next is go into the app.prepare method, our function and just go ahead and add some routes. So what we're going to do is go ahead and do server.get which is the function that we need to get a route. And then we're going to call this route page two and you have the typical syntax for express. So request response. This is a function. So what are we going to return when we call in page two is we're going to render page two. So we're going to create a page for that route shortly. So let's go ahead and get to the next one. So what I'm going to do is basically copy those three lines and then paste them again. And…

Contents