Fork me on GitHub
#yada
<
2018-10-08
>
stijn09:10:25

if I want to run a yada handler in a synchronous web server is (let [handler (yada.handler/as-handler my-handler)] (deref (handler req))) the way to go? (i understand that this makes everything execute on the calling thread)

grav11:10:19

@malcolmsparks Cool, actually it was in connection with implementing CORS that I started wondering. I was imagining an exposed helper function that took a policy statement and returned a function, corresponding to a :options method that the user then has to explicitly place in the route-datastrucutre. It maps more one-to-one to how the requests are made, but it's of course more verbose. I'll read through the blog 🙂

malcolmsparks11:10:39

Yada is quite opinionated about this. URLs link to resources (that's the R in URL). Resources expose methods. There are very many Web frameworks out there where it is common to put methods in routes. That is not the model described by HTTP's authors in the RFCs. I think this is why web development ends up being harder than it was intended to be.