In this exercise, we will create a simple web service which streams data to the client. The projects main node is the web.async_http node which listens for incoming HTTP requests. It accepts an authentication node and needs to be terminated by a web.async_finish_request node.
Begin by dragging the following nodes onto the workspace:
web.async_httpweb.async_finish_request
Create Node. This node will be used to generate the data that will be streamed to the client. Rename the new code and call it Hello, world.
Connect them according to the image below:
Right click on the Hello, world-node and commit the following code:
https://<job id>.p.mainly.cloud
The <job id> you find if you click the job indocator in the top right of the workspace screen:
Here we see that the ID is 01hwawbp7aam0cx8jcwzt38vtj and if we go to https://01hwawbp7aam0cx8jcwzt38vtj.p.mainly.cloud/docs we can verify that the service is running. Next we need to write the client code. For this we need Visual Studio code or similar and an installed python environment on our desktop.
This is the client code we’re going to use: