I wrote a SPA with Scala.js, where I use a library called RosHTTP in order to communicate with a REST backend. It helps me add query parameters, set headers, work with cookies and increase transfer limits for very large responses from the backend, amongst other features. It lets me conveniently define handlers for success, error, etc.
Now, that library is no longer maintained, and when I look around the
Internet, I find no real replacements for it. I have therefore started using
the API from scalajs.dom, XMLHttpRequest, but that API is very
basic. For example, how do you handle cookies? How do you add query
parameters to POST requests, etc.?
My question therefore is: how do other Scala.js developers solve this
problem? It seems to me that most libraries in one form or another
facade an underlying JavaScript library (RosHTTP did that,
scalajs-io/request does it to give another example), which offers these types of convenience
calls that I'm talking about. But none of the examples, I mentioned
is still maintained and up to date. Am I to write yet another,
personal facade, am I to work with the XMLHttpRequest-type API I
mentioned above?
I'd be very curious, if there exists a kind-of idomatic way to connect a Scala.js frontend with a REST backend, without re-inventing the wheel.