Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adapters for popular libraries #21

Open
cornerman opened this issue Jul 24, 2019 · 3 comments
Open

Adapters for popular libraries #21

cornerman opened this issue Jul 24, 2019 · 3 comments

Comments

@cornerman
Copy link
Owner

I think it would be great to have examples/blueprints/helpers for popular libraries that can be used with sloth. For example, it would be great to have a simple RequestTransport and Router-Adapter for libraries like http4s and akka-http that covers the basic use-cases.

I have done this in a very opinionated way in https://github.com/cornerman/covenant for akka-http. It covers more than only basic use-cases and enforces a certain paradigm. So a question is how complex and sophisticated our implementations should be. I would like them to follow the same interface so you can still abstract over features they give you. And all implementations should provide more or less the same feature set.

We should also look at other areas than only http or websocket communication. One specific example I have, you can use sloth to abstract over messaging between your javascript website and your serviceworker. This another example I would like to provide.

Should these helper libraries live in this repo or should they be decoupled from it? Is it more of an example or a full-fledged adapter than can handle a lot configurations?

@marcgrue
Copy link

marcgrue commented Apr 5, 2021

Hi @cornerman!

I was happy to discover your excellent Sloth library and have been working the last few days to make some adoptions/adapters for Play ScalaJS that you can check out from https://github.com/marcgrue/play-scalajs where I have also made a similar adoption using the https://github.com/lihaoyi/autowire library.

As you can see I made a maven-published version of some minimal boilerplate code and then two more projects, one using the dependency and the other including the files. I'm wiring with both Ajax and WebSocket.

I did the most basic and simple implementations I could come up with to make the essential moving parts as clear as possible. I think it would great and helpful if you would consider to make similar implementations for other frameworks as you contemplate in the above comment! For me it was hard to "see through" for instance the Zio mechanics - have never worked with it, and I'm not a FP shark ;-)

I'm really happy to have achieved an end-user simplification by using Sloth compared to using Autowire, like for instance calling the api with foo.incr(1) instead of foo().incr(1).call() but also in the setup.

If you have any comments to my implementations, I would be very happy to hear from you!

All the best and thanks for your efforts creating Sloth!
/ Marc

@vic
Copy link
Contributor

vic commented Dec 10, 2021

I've just made an ammonite runnable demo for my co-workers at @deal-engine using Twitter Finagle Mux as transport.

https://twitter.com/oeiuwq/status/1469094434344218628

If anyone is interested, we could try extracting an adapter for finagle mux.

We previously used covenant on Scala.js for consuming an akka-http API. But this time we are creating an internal service where we care about re-using connections as much as possible and fast serialization (without using an IDL since our service will expose large legacy api interfaces - wich Sloth is pretty much happy to generate stubs for)

Thanks for your awesome libraries, @cornerman

@cornerman
Copy link
Owner Author

cornerman commented Jun 25, 2024

We have started with a sloth-jsdom-client, sloth-http4s-client and sloth-http4s-server package in this repository. See readme: https://github.com/cornerman/sloth?tab=readme-ov-file#integrations

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants