From 54bc7c45ceb4f7e0a4f5fb885b710bb80123fed6 Mon Sep 17 00:00:00 2001 From: Danny Yoo Date: Fri, 5 Apr 2013 14:13:55 -0600 Subject: [PATCH] got the sandbox to start working. --- whalesong/repl-prototype/server.rkt | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/whalesong/repl-prototype/server.rkt b/whalesong/repl-prototype/server.rkt index dcd5417..816076f 100644 --- a/whalesong/repl-prototype/server.rkt +++ b/whalesong/repl-prototype/server.rkt @@ -16,6 +16,8 @@ "../js-assembler/assemble.rkt" (for-syntax racket/base)) +(provide start-server) + (define-runtime-path htdocs (build-path "htdocs")) (define language @@ -75,6 +77,7 @@ [else #f])) ;; Compile the program here... (with-handlers ([exn:fail? (lambda (exn) + (printf "Error: ~s\n" (exn-message exn)) (write-json (hash 'type "error" 'message (exn-message exn)) op))]) @@ -119,10 +122,12 @@ -(define (start-server #:port [port 8000]) +(define (start-server #:port [port 8000] + #:listen-ip [listen-ip "127.0.0.1"]) (thread (lambda () (printf "starting web server on port ~s\n" port) (serve/servlet start + #:listen-ip listen-ip #:servlet-path "/compile" #:extra-files-paths (list htdocs) #:launch-browser? #f @@ -133,7 +138,7 @@ (require racket/cmdline) (void (command-line #:once-each - [("-p" "--port") p "Port (default 8080)" + [("-p" "--port") p "Port (default 8000)" (current-port (string->number p))])) (start-server #:port (current-port))) \ No newline at end of file