I'm trying to init ajax request to backend which was built in spock
handling post and get request is quite easy, there are post and get from spock to handle these request.
- https://hackage.haskell.org/package/Spock-core-0.14.0.0/docs/Web-Spock-Core.html#v:get
- https://hackage.haskell.org/package/Spock-core-0.14.0.0/docs/Web-Spock-Core.html#v:post
when I'm trying to handle prefight request which inited by ajax library.
it requires OPTIONS verb, I failed to find one to handle that .
Pls kindly advise how to solve this issue ( handling OPTIONS verb in spock) ? Thanks !
Looking at the source of that module,
getis defined as justhookRoute GET, andpostis defined as justhookRoute POST, so just callhookRoute OPTIONSwith the path and action you want to match.