diff --git a/extra/webapps/counter/counter.factor b/extra/webapps/counter/counter.factor index f3efb3868f..a0ee3a1b29 100644 --- a/extra/webapps/counter/counter.factor +++ b/extra/webapps/counter/counter.factor @@ -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- ] "dec" add-responder "" add-responder ; + +! 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-db + main-responder set-global + 8080 httpd ; + +MAIN: run-counter