Chapter 9: Implementing Server-Side Rendering

With our progress from the last chapter, we are now serving multiple pages under different paths with our React application. Currently, all of the routing happens directly on the client. In this chapter, we will look at the advantages and disadvantages of server-side rendering (SSR). By the end of the chapter, you will have configured Graphbook to serve all pages as pre-rendered HTML from the server instead of the client.

This chapter covers the following topics:

  • Introducing SSR
  • Setting up SSR in Express.js to render React on the server
  • Enabling JSON Web Token (JWT) authentication in connection with SSR
  • Running all of our GraphQL queries in the React tree

Technical requirements

The source code ...

Get Full-Stack Web Development with GraphQL and React - Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.