This repo is a small experiment to compare how client- and server-side rendering works with Apollo client.
The client is built with React, and contains three different views:
- About - Static page indicating whether the app is client- or server-side rendered
- Counter - A page that counts how many times the button is clicked. This acts as proof that the bundle.js file is successfully fetched and loaded on the browser
- Players - A page that fetches a mocked response from the Apollo server. This acts as proof that the app is successfully fetching and receiving data from the Apollo server
- Build and run Apollo server
cd apolloServer
npm i
npm start
- Build and run server-side rendered React app
cd ssr/
npm i
npm run build
npm run start
-
Visit http://localhost:3003/
-
Inspect the network tab and see that a request was NOT made to the Apollo server
- Build and run Apollo server
cd apolloServer
npm i
npm start
- Build and run client-side rendered React app
cd csr/
npm i
npm start
-
Visit http://localhost:3000/
-
Inspect the network tab and see that a request was made to the Apollo server