Skip to Main Content
React Projects
book

React Projects

by Roy Derks
December 2019
Intermediate to advanced content levelIntermediate to advanced
474 pages
10h 3m
English
Packt Publishing
Content preview from React Projects

Creating an express server with react-router

There is no standard pattern to enable SSR for your React application, but the starting point is to create a Node.js server that's serving the entry for running the build version for your application. For this, you'll use a minimal API framework for Node.js called express. Also, the packets that you've already used, such as react-router and styled-components, can work with SSR as well:

  1. You can start by installing express by running the following:
npm install express
  1. Now, you must create a new directory called server in the projects' root directory and place a new file called server.js inside. In this file, you can place the following code block to import packages you need to run the Node.js ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

React Projects - Second Edition

React Projects - Second Edition

Roy Derks
Test-Driven React

Test-Driven React

Trevor Burnham

Publisher Resources

ISBN: 9781789954937Supplemental Content