purescript-payload
purescript-payload copied to clipboard
OPTIONS handler for pre-flight CORS request
I was wondering how one would go about implementing a handler for pre-flight CORS requests? Thanks!
Unfortunately the OPTIONS method is not supported at the moment, and I don't believe there are good workarounds. I made another issue to track that: https://github.com/hoodunit/purescript-payload/issues/11. After that is added the way to do CORS would probably be through a request guard, but it might need a little more thought.
Adding endpoints with the OPTIONS
method is now supported with the v0.3.1
changes. This still doesn't quite support this use case, however, without some awkward workarounds (like adding OPTIONS endpoints manually for each endpoint that needs it). But I think with a little re-work this use case can be supported via request guards.