File tree Expand file tree Collapse file tree 1 file changed +13
-1
lines changed Expand file tree Collapse file tree 1 file changed +13
-1
lines changed Original file line number Diff line number Diff line change @@ -25,8 +25,18 @@ npm install xhr2
25
25
You can construct requests with the ` affjax ` function:
26
26
27
27
``` purescript
28
+ module Main where
29
+
30
+ import Prelude
31
+ import Control.Monad.Eff.Console (log)
32
+ import Control.Monad.Eff.Class (liftEff)
33
+ import Control.Monad.Aff (launchAff)
34
+ import Data.Either (Either(..))
35
+ import Data.HTTP.Method (Method(..))
36
+ import Network.HTTP.Affjax (affjax, defaultRequest)
37
+
28
38
main = launchAff $ do
29
- res <- affjax $ defaultRequest { url = "/api", method = GET }
39
+ res <- affjax $ defaultRequest { url = "/api", method = Left GET }
30
40
liftEff $ log $ "GET /api response: " ++ res.response
31
41
```
32
42
@@ -35,6 +45,8 @@ main = launchAff $ do
35
45
Or use of a number of helpers for common cases:
36
46
37
47
``` purescript
48
+ import Network.HTTP.Affjax (get, post)
49
+
38
50
main = launchAff $ do
39
51
res1 <- get "/api"
40
52
liftEff $ log $ "GET /api response: " ++ res1.response
You can’t perform that action at this time.
0 commit comments