rsvp
gleam add rsvp@1
Rsvp helps you make HTTP requests and handle their responses in a Lustre application. This library supports both client side SPAs and components, and server components meaning applications that use rsvp are more likely to be suitable as universal components.
Usage
Rsvp separates the concerns of making HTTP requests from handling their responses meaning we need to do three things to properly make a request:
-
First, we must define a
Handler
that describes how to handler the response and turn it into a message yourupdate
function can understand. -
Second, we must create the
Effect
that describes the request using either theget
orpost
convenience functions, or by constructing aRequest
and usingsend
directly. -
Finally, we must return that
Effect
in our application’sinit
orupdate
functions so that the runtime can perform the request.
Recipes
The following recipes are available to help you get started with rsvp:
If you think a common use case is missing or you’d like to contribute a recipe yourself, please open an issue or pull request!