Update data on a SPA created with Next.js and SSG

35 views Asked by At

I created a Single Page Application that have data (products) that are updated every few days. I deployed my application on a Hostinger server with Static Site Generation.

I would like to update my products without rebuild the site on each updates. The products are in a zip archive on my Hostinger DB, next to my HTML file etc.

I read a lot about getServerSideProps, getStaticProps, revalidate but I admit that I'm lost. English is not my native language so it doesn't help me lol.

I try to :

Get data with getServerSideProps or getStaticProps. The data is just fetch at build time.

Put "{next: {revalidate: 0 }}" or "cache: 'no-store'" in my fetch parameter. It works fine on dev mode but in production, I have a 403 Forbidden error when I go to my site. Then put revalidate : 3600 because the time doesn't really matter, I just want have an automatic update from time to time.

Fetch data from the client side but I have an error with next : "can't resolve : fs" It seems that it comes from the unzip library that I use to read the zip archive.

Fetch data with tanstack library but I still have the "fs module" error

Reading a lot of docs but now I'm lost and very confused because it seems that my problem is solvable.

If anyone can help me, thank you in advance. :)

0

There are 0 answers