I will use the frontend I build with WeWeb only self-hosted using the REST APi plugin with a Google Go backend (embedded).
To communicate with the REST API plugin when I develop in WeWeb, I need to put the URL path of it in a variable that represent a public URL while I’m in WeWeb to access my data but manually change it to “localhost:xxxx” when I self-host it within my backend file structure.
How and what is the best practive to create and store that variable in a local file that the compile WeWeb web site will use if a change it manually.
Also, don’t want any dependencies to any WeWeb server API.
Help would be apprecited! Thank you
Hey @i42tech
So you want to change the URL of your endpoints (used in the REST API plugin) depending on if your are in the Editor or self-hosted? Is that correct?
That is correct. Would like to change that setting in a local file that I would change before deploying my application (self hosted). Also, are you guys planning something in the future to be able to have the Rest API (self hosted) be able to communicate with the WeWeb editor (online) without having me to open ports to get to it? Like a local WeWeb application or communication via Tailscale for example.
Hey @i42tech,
Here are some options you can try:
- have a bound url and depending on the website url to switch the back-end url
- or when you export the project files, start a script to modify the urls in the exported files
Nothing planned for the Rest API in that way.
If you can bind the things you want to bind, then you can use the flag to know if it’s editor or production and bind it conditionally