1 USING: math kernel accessors http.server http.server.dispatchers
2 furnace furnace.actions furnace.sessions furnace.redirection
3 html.components html.forms html.templates.chloe
9 TUPLE: counter-app < dispatcher ;
11 M: counter-app init-session* drop 0 count sset ;
13 : <counter-action> ( quot -- action )
17 URL" $counter-app" <redirect>
20 : <display-action> ( -- action )
22 [ count sget "counter" set-value ] >>init
23 { counter-app "counter" } >>template ;
25 : <counter-app> ( -- responder )
26 counter-app new-dispatcher
27 [ 1+ ] <counter-action> "inc" add-responder
28 [ 1- ] <counter-action> "dec" add-responder
29 <display-action> "" add-responder