What I’m trying to do:
I have an app whose sole purpose is to host an API endpoint. That endpoint is mapped to a custom domain, so it can be hit from any browser in the world.
What I’ve tried and what’s not working:
I don’t know how to publish this Anvil app without having a ‘Startup Form,’ as such if people ‘browse’ to my api endpoint url, that page is displayed. I tried to use anvil.http.request to immediately redirect them to our corporate website, however, it won’t work in client code because of browser restrictions. Okay, so I moved that http.request to a server module, on init of the startup form, I call that function. It calls okay, but I see this: <anvil._serialise.StreamingMedia object at 0x7fce07c59750>
my client code:
python
anvil.server.call(‘redirect’)
my server module:
@anvil.server.callable
def redirect():
resp = anvil.http.request(“https://www.cybeta.com”)
print(resp)