on master help sign in
first draft complete
commit65048fef4621f6d7fb145568ec49f89a4805b471 authorHenry Ault <henry@tlon.io> dateTue 12 Apr 2016, 10:05 (11 years ago) parent1532c0f
1 file changed+11−11
docs/programming/system/http.md+11−11
docs/programming/system/http.md+11−11
@@ -9,21 +9,21 @@ Let's figure out how to make HTTP requests and set timers.
99
1010Let's build an uptime-monitoring system. It'll ping a web
1111service periodically and print out an error when the response
12−code isn't 2xx. Here's `ape/up.hoon`:
12+code isn't 2xx. Here's `app/up.hoon`:
1313
1414```
1515/? 314
1616|%
17−++ move ,[bone card]
17+++ move {bone card}
1818++ card
19− $% [%them wire (unit hiss)]
20− [%wait wire @da]
19+ $% {%them wire (unit hiss)}
20+ {%wait wire @da}
2121 ==
2222--
23−|_ [hid=bowl on=_| in-progress=_| target=@t]
23+|_ {hid/bowl on/_| in-progress=_| target/@t}
2424++ poke-cord
25− |= url=@t
26− ^- [(list move) _+>.$]
25+ |= url/@t
26+ ^- {(list move) _+>.$}
2727 ?: =('off' url)
2828 [~ +>.$(on |)]
2929 ?: =('on' url)
@@ -33,8 +33,8 @@ code isn't 2xx. Here's `ape/up.hoon`:
3333 [ost.hid %them /request ~ (need (epur target)) %get ~ ~]~
3434 [~ +>.$(target url)]
3535++ thou-request
36− |= [wir=wire code=@ud headers=mess body=(unit octs)]
37− ^- [(list move) _+>.$]
36+ |= {wir/wire code/@ud headers/mess body/(unit octs)}
37+ ^- {(list move) _+>.$}
3838 ?: &((gte code 200) (lth code 300))
3939 ~& [%all-is-well code]
4040 :_ +>.$
@@ -49,7 +49,7 @@ code isn't 2xx. Here's `ape/up.hoon`:
4949 [ost.hid %wait /timer (add ~s10 now.hid)]~
5050 ~
5151++ wake-timer
52− |= [wir=wire ~]
52+ |= {wir/wire ~}
5353 ?: on
5454 :_ +>.$
5555 [ost.hid %them /request ~ (need (epur target)) %get ~ ~]~
@@ -97,7 +97,7 @@ produce a `%wake` when the time comes.
9797Let's take a look at our state:
9898
9999```
100−|_ [hid=bowl on=_| in-progress=_| target=@t]
100+|_ {hid/bowl on/_| in-progress=_| target/@t}
101101```
102102
103103We have three pieces of app-specific state. `target` is the url