webapps.calculator: using run-test-httpd word
parent
ba7d357a6e
commit
914a9be1f4
|
@ -1,8 +1,8 @@
|
||||||
! Copyright (C) 2008, 2009 Slava Pestov.
|
! Copyright (C) 2008, 2009 Slava Pestov.
|
||||||
! 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: accessors furnace.actions furnace.alloy furnace.redirection
|
||||||
http.server.dispatchers html.forms validators urls accessors
|
html.forms http.server http.server.dispatchers math namespaces urls
|
||||||
math kernel io.directories fry ;
|
validators webapps.utils ;
|
||||||
IN: webapps.calculator
|
IN: webapps.calculator
|
||||||
|
|
||||||
TUPLE: calculator < dispatcher ;
|
TUPLE: calculator < dispatcher ;
|
||||||
|
@ -31,19 +31,14 @@ TUPLE: calculator < dispatcher ;
|
||||||
<calculator-action> >>default ;
|
<calculator-action> >>default ;
|
||||||
|
|
||||||
! Deployment example
|
! Deployment example
|
||||||
USING: db.sqlite furnace.alloy namespaces http.server ;
|
: calculator-db ( -- db ) "calculator.db" <temp-sqlite-db> ;
|
||||||
|
|
||||||
: calculator-db ( -- db ) "calculator.db" <sqlite-db> ;
|
: <calculator-app> ( -- dispatcher )
|
||||||
|
<calculator> calculator-db <alloy> ;
|
||||||
|
|
||||||
: run-calculator ( port -- )
|
! Calculator runs at port 8081 and 8431
|
||||||
'[
|
: run-calculator ( -- )
|
||||||
<calculator>
|
<calculator-app> main-responder set-global
|
||||||
calculator-db <alloy>
|
run-test-httpd ;
|
||||||
main-responder set-global
|
|
||||||
_ httpd drop
|
|
||||||
] with-resource-directory ;
|
|
||||||
|
|
||||||
: run-calculator-main ( -- )
|
MAIN: run-calculator
|
||||||
8080 run-calculator ;
|
|
||||||
|
|
||||||
MAIN: run-calculator-main
|
|
||||||
|
|
Loading…
Reference in New Issue