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 !
CodePudding user response:
Looking at the source of that module, get
is defined as just hookRoute GET
, and post
is defined as just hookRoute POST
, so just call hookRoute OPTIONS
with the path and action you want to match.