You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+18Lines changed: 18 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -50,6 +50,7 @@
50
50
-[Internals](#internals)
51
51
-[Examples](#examples)
52
52
-[Building examples](#building-examples)
53
+
-[Coverage](#interacting-with-http-apis)
53
54
-[Coverage](#coverage)
54
55
-[Isomorphic](#isomorphic)
55
56
-[Benchmarks](#benchmarks)
@@ -578,6 +579,23 @@ cd result/bin/todo-mvc.jsexe && http-sever
578
579
Serving HTTP on 0.0.0.0 port 8000 ...
579
580
```
580
581
582
+
## Interacting with HTTP APIs 🔌
583
+
584
+
If you want to interact with an HTTP API, we recommend one of the following approaches:
585
+
586
+
1. For a simple JSON-based API, you can use Miso's `fetchJSON` function.
587
+
588
+
2. In more complex cases, you can define a [Servant](https://www.servant.dev/) API and automatically obtain client functions via `servant-client-js` (or any other `servant-client-core`-based backend).
589
+
590
+
The Fetch example ([Source](https://github.com/dmjio/miso/blob/master/examples/fetch/Main.hs), [Demo](https://fetch.haskell-miso.org/)) demonstrates the necessary ingredients. Make sure to add the following to your `cabal.project`:
The core engine of `miso` is the [diff](https://github.com/dmjio/miso/blob/master/ts/dom.ts) function. It is responsible for all DOM manipulation that occurs in a miso application and has [100% code coverage](http://coverage.haskell-miso.org). Tests and coverage made possible using [bun](https://github.com/oven-sh/bun).
0 commit comments