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/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" "<br>"> =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: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
}
client
:serve-html-string<index.html "/">
:serve-html-string<features.html "/features">
:serve-file-cached<"style.css" "/style.css" "text/css">
:is-open
if {
404.html client:write-head<404 "Not found">:write-html-body:finish;
}
}