This commit is contained in:
Daniella / Tove 2024-10-14 14:08:00 +02:00
commit d15a82d915
Signed by: TudbuT
GPG key ID: B3CF345217F202D3

View file

@ -1,4 +1,5 @@
"#httpserver/base.spl" import "#httpserver/base.spl" import
"#httpserver/static.spl" import
func destub { html | with html title ; func destub { html | with html title ;
stub.html stub.html
@ -10,7 +11,6 @@ func destub { html | with html title ;
def lorem-ipsum "lorem-ipsum" read-file:replace<"\n" "<br>"> =lorem-ipsum def lorem-ipsum "lorem-ipsum" read-file:replace<"\n" "<br>"> =lorem-ipsum
def stub.html "stub.html" read-file =stub.html 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 404.html "404.html" read-file destub<"404"> =404.html
def index.html "index.html" read-file destub<"Home"> =index.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 ; func handle-client { | with client ;
client:path "/" eq if { client
index.html client:write-ok:write-html-body:finish; :serve-html-string<index.html "/">
2 stop :serve-html-string<features.html "/features">
} :serve-file-cached<"style.css" "/style.css" "text/css">
client:path "/features" eq if { :is-open
features.html client:write-ok:write-html-body:finish; if {
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; 404.html client:write-head<404 "Not found">:write-html-body:finish;
} }
}