From: Björn Lindqvist Date: Mon, 5 Dec 2016 08:40:29 +0000 (+0100) Subject: webapps.calculator: using run-test-httpd word X-Git-Tag: unmaintained~364 X-Git-Url: https://gitweb.factorcode.org/gitweb.cgi?p=factor.git;a=commitdiff_plain;h=914a9be1f48319d009cdd00fb29129fc82bc971e webapps.calculator: using run-test-httpd word --- diff --git a/extra/webapps/calculator/calculator.factor b/extra/webapps/calculator/calculator.factor index cdfd6b988d..402143b947 100644 --- a/extra/webapps/calculator/calculator.factor +++ b/extra/webapps/calculator/calculator.factor @@ -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 ; >>default ; ! Deployment example -USING: db.sqlite furnace.alloy namespaces http.server ; +: calculator-db ( -- db ) "calculator.db" ; -: calculator-db ( -- db ) "calculator.db" ; +: ( -- dispatcher ) + calculator-db ; -: run-calculator ( port -- ) - '[ - - calculator-db - main-responder set-global - _ httpd drop - ] with-resource-directory ; +! Calculator runs at port 8081 and 8431 +: run-calculator ( -- ) + main-responder set-global + run-test-httpd ; -: run-calculator-main ( -- ) - 8080 run-calculator ; - -MAIN: run-calculator-main +MAIN: run-calculator