Wish the web server handles route "/static-html/$" with handler {
html "
Hello World!
"
}
Wish the web server handles route "/score/$" with handler {
json "{\"score\": 5}"
}
When the collected matches for [list /regionName/ has region /region/] are /regionMatches/ {
Wish the web server handles route "/regions/$" with handler [list Evaluator::tryRunInSerializedEnvironment {
set body ""
foreach match $regionMatches {
append body "- [dict get $match regionName]: [dict get $match region]
"
}
append body "
"
html $body
} [Evaluator::serializeEnvironment]]
}
Wish the web server handles route "/redirect/$" with handler {
dict create statusAndHeaders "HTTP/1.1 302 Found\nLocation: https://folk.computer"
}
Wish the web server handles route {/pagee/(\d*)$} with handler {
if {[regexp -all {/pagee/(\d*)$} $path whole_match pageNumber]} {
html "Hello Page Number $pageNumber
"
}
}