1 ! Copyright (C) 2011 John Benediktsson
2 ! See http://factorcode.org/license.txt for BSD license
4 USING: accessors furnace.actions http.server
5 http.server.dispatchers http.server.responses http.server.static
10 : <hello-action> ( -- action )
12 [ "Hello, world!" <text-content> ] >>display ;
14 TUPLE: benchmark < dispatcher ;
16 : <benchmark> ( -- dispatcher )
17 benchmark new-dispatcher
18 <hello-action> "hello" add-responder
19 "resource:" <static> "static" add-responder ;
21 : run-benchmark-webapp ( -- )
23 main-responder set-global
26 ! Use this with apachebench:
29 ! http://localhost:8080/hello
32 ! http://localhost:8080/static/readme.html
34 MAIN: run-benchmark-webapp