diff --git a/server.spl b/server.spl
index 6f0988f..864bfbd 100644
--- a/server.spl
+++ b/server.spl
@@ -1,4 +1,5 @@
"#httpserver/base.spl" import
+"#httpserver/static.spl" import
func destub { html | with html title ;
stub.html
@@ -10,7 +11,6 @@ func destub { html | with html title ;
def lorem-ipsum "lorem-ipsum" read-file:replace<"\n" "
"> =lorem-ipsum
def stub.html "stub.html" read-file =stub.html
-def style.css "style.css" read-file =style.css
def 404.html "404.html" read-file destub<"404"> =404.html
def index.html "index.html" read-file destub<"Home"> =index.html
@@ -40,19 +40,13 @@ func main { mega | with args ;
}
func handle-client { | with client ;
- client:path "/" eq if {
- index.html client:write-ok:write-html-body:finish;
- 2 stop
+ client
+ :serve-html-string
+ :serve-html-string
+ :serve-file-cached<"style.css" "/style.css" "text/css">
+ :is-open
+ if {
+ 404.html client:write-head<404 "Not found">:write-html-body:finish;
}
- client:path "/features" eq if {
- features.html client:write-ok:write-html-body:finish;
- 2 stop
- }
-
- client:path "/style.css" eq if {
- style.css client:write-ok:write-content-type<"text/css">:write-str-body:finish;
- 2 stop
- }
-
- 404.html client:write-head<404 "Not found">:write-html-body:finish;
}
+