purescript-cookbook icon indicating copy to clipboard operation
purescript-cookbook copied to clipboard

How to send AJAX requests via `affjax`

Open JordanMartinez opened this issue 5 years ago • 5 comments

Description of Problem

Send and handle AJAX requests.

Proposed Name of Folder/Module

Unique Recipe Name: AjaxRequestsAffJax

JordanMartinez avatar Jun 26 '20 20:06 JordanMartinez

Since there are a few HalogenHooks recipes that use Affjax, is this recipe still necessary?

JordanMartinez avatar Jul 17 '20 19:07 JordanMartinez

I think it could be useful, like as a minimal example, I'm thinking this could be made as a Log-type recipe that runs either in Node or in the browser.

pete-murphy avatar Jul 17 '20 19:07 pete-murphy

Oh right. I don't think we have an example in node and that requires adding xhr2, right?

JordanMartinez avatar Jul 17 '20 20:07 JordanMartinez

Ah, yeah, I believe it would require adding xhr2.

pete-murphy avatar Jul 17 '20 21:07 pete-murphy

Feel free to copy over any of the Affjax examples in the book. https://github.com/purescript-contrib/purescript-book/tree/master/exercises/chapter12/test For example endpoints, I found http://reqres.in/api more reliable than https://jsonplaceholder.typicode.com/

milesfrain avatar Jul 18 '20 00:07 milesfrain