Url to call api must be different iffit’s use client or server side component ? Idk quesion good ?t
Unanswered
Berylline Hummingbird posted this in #help-forum
Berylline HummingbirdOP
hello, I think I am missing something, when you use a next js app and use a different app for api to provide data, the url to make calls must be different if it's "use client" client component or server side like localhost if it's server component and domain.com/api for server components
3 Replies
yeah
use cleint
call from your browser and when you use the server componnet it call from nextjs local server!Berylline HummingbirdOP
So how do you handle the address of a api you need to change it if it’ called from client to the server url and if its called from server action it’s local ip like docker or localhost
Yellowstripe scad
Not sure I understand what the question here is, but you can query your external API from a Server component, and pass the data down via props to a client component, or handle the data fetch directly on the client.