How do I get the host or full request url inside a "use server" function?
For example, maybe I have this:
the issue is at
The
https://my-api.com part needs to change according to the current host of the request (eg. development would be localhost, staging would be somewhere else etc.)
How can I access that within the getPost function?
window is not available so I can't do window.location.hostname
It would also be helpful to be able to access the full request url in there2 Replies
Probably best is to use environment variable for this.
But there is also
getReuqestEvent()
https://docs.solidjs.com/reference/server-utilities/get-request-event#getrequesteventgetRequestEvent - Solid Docs
Documentation for SolidJS, the signals-powered UI framework
Thank you! That works