diff --git a/README.md b/README.md index 4c26b1e..a3b2084 100644 --- a/README.md +++ b/README.md @@ -16,3 +16,23 @@ gleam add finch_gleam ``` and its documentation can be found at . + +## Usage + +```gleam +import gleam/uri +import gleam/http +import gleam/http/request +import gleam/erlang/atom +import finch + +assert Ok(url) = uri.parse("https://example.com/") +assert Ok(req) = request.from_uri(url) +let req = request.Request(..req, method: http.Post, body: "foo bar") + +// Build Finch request from gleam/http request +let finch_req = finch.build(req, []) + +// Run request with Finch, using Finch.Server, returns gleam/http response +assert Ok(resp) = finch.request(finch_req, atom.create_from_string("Elixir.Finch.Server")) +```