This follows the same model described above - the request (and response) comes into a subscription port, and the filled in response goes back out a port. The elm-serverless framework ties those 2 things together by maintaining a connection id and letting you have a Model as context over the whole request/response cycle.
elm-serverless has a modified XMLHttpRequest object, that lets you use elm/http just as you would in a browser application. Your HTTP requests will trigger events in the application with the correct context attached.
It can run in standalone mode too, not just for deploying to the cloud, although the standalone mode is more meant for development.
One issue is requests with binary data - since Elm ports cannot pass Bytes. There is probably a workaround for this by putting the data in a File which can go through a port.
Might also be worth taking a look at package.elm-lang.org/packages/the-...
This follows the same model described above - the request (and response) comes into a subscription port, and the filled in response goes back out a port. The elm-serverless framework ties those 2 things together by maintaining a connection id and letting you have a
Model
as context over the whole request/response cycle.elm-serverless
has a modified XMLHttpRequest object, that lets you useelm/http
just as you would in a browser application. Your HTTP requests will trigger events in the application with the correct context attached.It can run in standalone mode too, not just for deploying to the cloud, although the standalone mode is more meant for development.
One issue is requests with binary data - since Elm ports cannot pass
Bytes
. There is probably a workaround for this by putting the data in aFile
which can go through a port.That is awesome!