webapps.calculator: Utility word to run the calculator on other ports.

db4
Doug Coleman 2014-05-05 20:44:23 -04:00
parent 5c9e270a1c
commit 0d4afd2f31
1 changed files with 8 additions and 5 deletions

View File

@ -2,7 +2,7 @@
! See http://factorcode.org/license.txt for BSD license. ! See http://factorcode.org/license.txt for BSD license.
USING: furnace furnace.actions furnace.redirection USING: furnace furnace.actions furnace.redirection
http.server.dispatchers html.forms validators urls accessors http.server.dispatchers html.forms validators urls accessors
math kernel io.directories ; math kernel io.directories fry ;
IN: webapps.calculator IN: webapps.calculator
TUPLE: calculator < dispatcher ; TUPLE: calculator < dispatcher ;
@ -35,12 +35,15 @@ USING: db.sqlite furnace.alloy namespaces http.server ;
: calculator-db ( -- db ) "calculator.db" <sqlite-db> ; : calculator-db ( -- db ) "calculator.db" <sqlite-db> ;
: run-calculator ( -- ) : run-calculator ( port -- )
[ '[
<calculator> <calculator>
calculator-db <alloy> calculator-db <alloy>
main-responder set-global main-responder set-global
8080 httpd drop _ httpd drop
] with-resource-directory ; ] with-resource-directory ;
MAIN: run-calculator : run-calculator-main ( -- )
8080 run-calculator ;
MAIN: run-calculator-main