factor/extra/webapps/ip/ip.factor

24 lines
603 B
Factor
Raw Normal View History

2008-09-10 21:45:48 -04:00
! Copyright (C) 2008 Doug Coleman.
! See http://factorcode.org/license.txt for BSD license.
2008-10-28 19:20:22 -04:00
USING: accessors furnace.actions http.server
2008-11-30 18:56:40 -05:00
http.server.dispatchers html.forms io.sockets
2008-10-28 19:20:22 -04:00
namespaces prettyprint ;
2008-09-10 21:45:48 -04:00
IN: webapps.ip
TUPLE: ip-app < dispatcher ;
: <display-ip-action> ( -- action )
<page-action>
[ remote-address get host>> "ip" set-value ] >>init
{ ip-app "ip" } >>template ;
: <ip-app> ( -- dispatcher )
ip-app new-dispatcher
<display-ip-action> "" add-responder ;
2008-10-28 19:20:22 -04:00
: run-ip-app ( -- )
<ip-app> main-responder set-global
8080 httpd ;
MAIN: run-ip-app