I would love to use the Elm architecture for writing an API
I explored something yesterday that feels pretty elm-ish.
Others have also made similar things, but I have not seen this version before.
( It also has no external dependencies, just plain nodejs code. No need for npm or node_modules )
It uses elm/url package to parse endpoints and the elm/http package to create server-responses. ( Responses is then built with known constructors like Http.stringBody, Http.jsonBody or Http.bytesBody++ ) ( I first tried a solution with ports, but then one could not respond with bytes/files )
This is not complete, more an idea to how elm could be used as a microservice/API. ( The response should maybe change to be tasks or something, so that you can do calls to a http-based database before you respond )
Here is a video walking through the details on how it works:
If you do not want to watch the video, this is how you write the API logic:
We parse, don’t validate. So Only valid fully parsed requests needs to be handled in update. ( The user object for create user is already parsed )
So how does the parsing look like?
I am not a professional backend developer, so is this a bad idea?
Anyone tried something similar? Any big issues with this thinking?