use SSR with backend server?
Im new to SSR stuff. in the past im using vite config for development and nginx for the production, so the backend api (in another language) is in the same domain as frontend. I want the SSR to fetch data from the backend to generate html, and I have read the "data fetching" section in the docs and seems it is about backend in nitro server. someone also mentions https://nuxt.com/docs/guide/directory-structure/components#standalone-server-components. what should i do?
Nuxt
components/ · Nuxt Directory Structure
The components/ directory is where you put all your Vue components.
5 Replies
Also, can i only render it on server side, so on the client side i don't have to request the backed api?
thanks so much, how to specify type on
$fetch
I found it out@joe_black_unluckyhi, a few questions here. as the doc said, im using
useFetch
to fetch data from the server. I configured vite proxy and it is ignored, so I have to specify full url such as localhost:8080/api/xxx
, and if I refresh the data on clients I think that will be broken. what should i do?I want to set the api url to
/api/xxxxx
so I can use nginx to reverse proxy on servers, but this causes SSR and dev failure
solved