1 ! Copyright (C) 2008, 2009 Slava Pestov.
2 ! See http://factorcode.org/license.txt for BSD license.
3 USING: furnace furnace.actions furnace.redirection
4 http.server.dispatchers html.forms validators urls accessors
8 TUPLE: calculator < dispatcher ;
10 : <calculator-action> ( -- action )
14 { { "z" [ [ v-number ] v-optional ] } } validate-params
17 { calculator "calculator" } >>template
25 URL" $calculator" "x" value "y" value + "z" set-query-param
29 : <calculator> ( -- responder )
30 calculator new-dispatcher
31 <calculator-action> >>default ;
34 USING: db.sqlite furnace.alloy namespaces http.server ;
36 : calculator-db ( -- db ) "calculator.db" <sqlite-db> ;
38 : run-calculator ( -- )
41 main-responder set-global