If you use own adapter you still make request at first to your remix app right ? #8504
Replies: 3 comments
-
A typical use case is to use Remix as a BFF (backend for frontend). The Remix app will call your loaders, which makes a fetch request to a backend API typically written in another language or on another server. If your "backend" API is in the same Remix app, you should simply call the function and not make a second fetch request. |
Beta Was this translation helpful? Give feedback.
-
So in my case it is normal to make two request, like the first to the loader and the second to my api ? |
Beta Was this translation helpful? Give feedback.
-
If your express server and remix server are two separate servers then you have to make two separate requests. But if your remix app is just a middleware of your express app, then you shouldn't be sending two network requests to fetch data because all the primitives you need to fetch data will already be available to you in your loader. You can abstract your data logic to get posts and reuse the same code in both the express route and in remix loader so your loader will directly talk to your database (or wherever you're getting your data from). |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Hello,
I want to use remix for my frontend but with ssr. I have a own express backend and I see I can use a adapter. So but when I make a query to my express backend it first goes to my remix backend like "/getPosts" in remix then I fetch the data from my backend then it goes to "/getPosts" to my express. It isnt bad that I make everytime two requests ? Can I reduce it or do I have missunderstood anything
Beta Was this translation helpful? Give feedback.
All reactions