Posts

Showing posts from August, 2022

How to Prerender React Apps Using Prerender and NGINX

Image
The prerender service will cache the static HTML for a while before requesting a new copy from the server. This method did not require me to change anything on my React app and only required me to make some adjustments to the NGINX server configuration. This is how my application was being served before prerender came into the mix: After adding prerender, the flow looked something like this: Setting up prerender service There are two ways you can make use of the prerender service. You can either make use of the  paid hosted service  (contains a free plan as well) or you can run the  open source service  on your server and interface with that. I decided to opt for the latter. The first step was to install prerender on the server. It was fairly straightforward to do so using npm: $ npm install prerender The next step was to create a new node script that ran the service. These 3 lines are enough to get the service up and running: const prerender = require ( 'prerender' ); const

Popular posts from this blog

How to download a file using command prompt (cmd) Windows?

The future of Artificial Intelligence: 6 ways it will impact everyday life

How to Include ThreeJs in Your Projects