How to access resource routes in UI routes #9032
-
I am trying to access a resource route for a POST endpoint in my ui route loader. When I attempt to The docs for Resource Routes feel incomplete because they do not show you how to consume the endpoints in any way. I was not able to find any articles about this matter online. Usually bundling libraries have base url constants or functions for constructing a url based upon the environment so I'm wondering if those exist for remix. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 2 replies
-
I understand this is related but instead of inquiring about supporting relative urls, I'm just looking for any solution to this more general issue. |
Beta Was this translation helpful? Give feedback.
So the
fetch
is from your loader? Are you trying to call an endpoint in the current app?You should always use an absolute URL in
fetch
for external server-side fetches.However, if you're calling an existing
loader
in your own app, extracting that to a shared function you call would be better. In other words, don't make a network request to an internal route.