Make counter runnable to demonstrate web app deployment
parent
be4915ee9c
commit
65e88f70b9
|
@ -1,3 +1,5 @@
|
|||
! Copyright (C) 2008 Slava Pestov.
|
||||
! See http://factorcode.org/license.txt for BSD license.
|
||||
USING: math kernel accessors http.server http.server.dispatchers
|
||||
furnace furnace.actions furnace.sessions furnace.redirection
|
||||
html.components html.forms html.templates.chloe
|
||||
|
@ -28,3 +30,20 @@ M: counter-app init-session* drop 0 count sset ;
|
|||
[ 1- ] <counter-action> "dec" add-responder
|
||||
<display-action> "" add-responder
|
||||
<sessions> ;
|
||||
|
||||
! Deployment example
|
||||
USING: db.sqlite db.tuples db furnace.db namespaces ;
|
||||
|
||||
: counter-db ( -- params db ) "counter.db" sqlite-db ;
|
||||
|
||||
: init-counter-db ( -- )
|
||||
counter-db [ session ensure-table ] with-db ;
|
||||
|
||||
: run-counter ( -- )
|
||||
init-counter-db
|
||||
<counter-app>
|
||||
counter-db <db-persistence>
|
||||
main-responder set-global
|
||||
8080 httpd ;
|
||||
|
||||
MAIN: run-counter
|
||||
|
|
Loading…
Reference in New Issue