From 4eacc5129b8612b65cf6b28b739cf8e62e616405 Mon Sep 17 00:00:00 2001 From: dan Date: Wed, 1 Mar 2023 13:11:48 -0500 Subject: style.css and favicon.ico properly hosted --- main.scm | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) (limited to 'main.scm') diff --git a/main.scm b/main.scm index c87f294..c3bfe98 100644 --- a/main.scm +++ b/main.scm @@ -57,9 +57,6 @@ ; (port (request-port request))) ; (read-u8vector len port))) -(define stylesheet (read-string #f - (open-input-file "./style.css" #:text))) - (define (top-posts) (map-row list db "SELECT p.id, p.user_id, p.content, p.created_at, p.parent_id, count(c.id) FROM posts p @@ -257,14 +254,13 @@ next "/"))) + (define routes `( (GET (/ "style.css") ,(lambda (rt) - (send-response - headers: `((content-type text/css)) - status: 'ok - body: stylesheet - ))) + (send-static-file "style.css"))) + (GET (/ "favicon.ico") ,(lambda (rt) + (send-static-file "favicon.ico"))) (GET (/ "unvote") ,(lambda (rt) (unvote (get-current-user)) (send-response @@ -376,5 +372,6 @@ ((third route) route) (begin (display uri ) (display method) (send-status 'not-found "Page Not Found"))))) +(root-path ".") (vhost-map `((".*" . ,handle))) (start-server port: 7080) -- cgit v1.2.3