Scala.js web client (Fetch)

Web client using Fetch.

API documentation

The Endpoints interpreter fixes the type Endpoint[A, B] to a function from A to Result[B], where Result is abstract and is intended to be defined by more specialized interpreters.

An example of such an interpreter is endpoints4s.fetch.client.future.Endpoints, which fixes the Result[A] type to scala.concurrent.Future[A].

This means that, given the following endpoint definition:

sourceval someResource: Endpoint[Int, String] =
  endpoint(get(path / "some-resource" / segment[Int]()), ok(textResponse))

It can be invoked as follows:

sourceval eventuallyString: Future[String] = someResource(42).future