Hi everyone,
I’m trying to run the “plain vanilla” example that leverages the WebUI - HTML Brick.
Below Python code:
from arduino.app_utils import App
from arduino.app_bricks.web_ui import WebUI
print("Hello bischeraccio!")
ui = WebUI()
ui.expose_api("GET", "/hello", lambda: {"message": "Hello, ciccetto!"})
App.run() # This will block until the app is stopped
Below the console:
… when I saw it first time I was very happy: everything seems fine, but then I copy/pasted in different attempts both Local URL and Network URL in the browser, and I got:
Surely I’m missing something obvious, but here I’am, in need for some help to start using the WebUI-HTML Brick
Thanks a lot for your help and suggestion,
Andrea
Hi @apagliari. Your code creates an endpoint at the path /hello. I am forced to guess due to you redacting the URL, but I suspect you tried to load the root of the webserver instead of the endpoint you created.
So try opening this URL in the browser of the UNO Q's Linux machine while the App is running:
http://localhost:7000/hello
(note the inclusion of the /hello path in the URL)
I think you will now see the expected output in the browser:
{"message":"Hello, ciccetto!"}
1 Like
Hi @ptillisch ,
you spot on!
Thanks a lot for your swing and effective help!
I was misdirected from the log message and I don’t have enough knowledge about webui and webservers, which by the way seems one of the key topics, together with SQLLite bricks, in order to really start leveraging the opportunities of the combination between “Arduino Sketch” and the “Python” side of the new house.
Again, thanks a lot
Andrea
1 Like