Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to use SSR with Nuxt.js on Netlify

The way I understand is Server Side Rendering (SSR) is where the server renders the page and then sends chunks of data to the browser via one stream as opposed to the browser (client) loading the HTML page and then making the requests for all the JS/CSS etc.

This is the behaviour I would like to support for my webpage. But following their guide for Netlify, generates static HTML pages as normal with links to all the external dependencies?

In that case won't running npm run generate disable SSR? Or am I completely misunderstanding how this works?

like image 220
S.Ramjit Avatar asked Nov 22 '25 14:11

S.Ramjit


1 Answers

Netlify is a static hosting service meaning that they don't support SSR, natively. I did reach out to them and they pointed me in the direction of using their functions to run an Express server.

An alternative to this if you want SSR without hassle is Heroku. Nuxt can also generate routes dynamically that you can then serve up to Netlify. The only downside is that if the information on your backend changes, you'd have to re run generate to fetch the new information.

like image 117
S.Ramjit Avatar answered Nov 25 '25 11:11

S.Ramjit