A Generic Handler For AWS SDK Operations in Elm
The code in this post is a work in progress.
What I really want is a generic handler. Here’s my first attempt (in TypeScript):
wire function does all the work of subscribing to requests and sending responses back to Elm.
It expects an object with
It then dynamically invokes the SDK function.
Here’s how that works.
This is what’s in the clients object:
If the elm code passes in ‘DynamoDB’ as the value of the client parameter, this function will invoke
operationName on an instance of
params argument is passed unmodified to the operation.
When the operation invokes its callback, I send that data unmodified back to the elm handler.
It’s up to the Elm to parse and dispatch the response as it sees fit.
That’s a topic for another post though.
Finally, I need an entry-point to set all this up:
If you liked this post, your followers might also. Please give it a share!
Did this article help?
blog comments powered by Disqus