You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
pollen/server.rkt

30 lines
1.1 KiB
Racket

#lang web-server
11 years ago
(require web-server/servlet-env
web-server/dispatch)
(require "server-routes.rkt"
"debug.rkt"
"world.rkt")
11 years ago
(define-values (pollen-servlet _)
(dispatch-rules
11 years ago
[((string-arg) ... (? (λ(x) (equal? DASHBOARD_NAME x)))) route-dashboard]
11 years ago
[((string-arg) ... "raw" (string-arg)) route-raw]
[((string-arg) ... "xexpr" (string-arg)) route-xexpr]
[else route-default]))
11 years ago
(message (format "Welcome to Pollen ~a" POLLEN_VERSION) (format "(Racket ~a)" (version)))
(message (format "Project root is ~a" PROJECT_ROOT))
11 years ago
11 years ago
(define server-name (format "http://localhost:~a" SERVER_PORT))
(message (format "Project server is ~a" server-name) "(Ctrl-C to exit)")
11 years ago
(message (format "Project dashboard is ~a/~a" server-name DASHBOARD_NAME))
11 years ago
(message "Ready to rock")
11 years ago
(serve/servlet pollen-servlet
#:port SERVER_PORT
#:listen-ip #f
#:servlet-regexp #rx"" ; respond to top level
#:command-line? #t
#:file-not-found-responder route-404
#:extra-files-paths (list SERVER_EXTRAS_DIR PROJECT_ROOT))