! Copyright (C) 2010 Benjamin Meinl.
! See http://factorcode.org/license.txt for BSD license.
USING: accessors io io.encodings.utf8 io.servers.connection multiline
threads ;
IN: simple-webserver
CONSTANT: port 8080
CONSTANT: host "localhost"
STRING: static-site
HTTP/1.1 200 OK
Mojolicious, baby!
Hi there
;
: handle-request ( -- )
static-site print ;
: ( -- threaded-server )
utf8
"time-server" >>name
port >>insecure
[ handle-request ] >>handler ;
: start-webserver ( -- threaded-server )
[ start-server ] in-thread ;
: stop-webserver ( threaded-server -- )
stop-server ;