webapps.calculator: using run-test-httpd word

char-rename
Björn Lindqvist 2016-12-05 09:40:29 +01:00
parent ba7d357a6e
commit 914a9be1f4
1 changed files with 11 additions and 16 deletions

View File

@ -1,8 +1,8 @@
! Copyright (C) 2008, 2009 Slava Pestov.
! See http://factorcode.org/license.txt for BSD license.
USING: furnace furnace.actions furnace.redirection
http.server.dispatchers html.forms validators urls accessors
math kernel io.directories fry ;
USING: accessors furnace.actions furnace.alloy furnace.redirection
html.forms http.server http.server.dispatchers math namespaces urls
validators webapps.utils ;
IN: webapps.calculator
TUPLE: calculator < dispatcher ;
@ -31,19 +31,14 @@ TUPLE: calculator < dispatcher ;
<calculator-action> >>default ;
! 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>
calculator-db <alloy>
main-responder set-global
_ httpd drop
] with-resource-directory ;
! Calculator runs at port 8081 and 8431
: run-calculator ( -- )
<calculator-app> main-responder set-global
run-test-httpd ;
: run-calculator-main ( -- )
8080 run-calculator ;
MAIN: run-calculator-main
MAIN: run-calculator