diff options
| author | Jacob Haip <jhaip@users.noreply.github.com> | 2023-03-22 02:51:57 +0000 |
|---|---|---|
| committer | Jacob Haip <jhaip@users.noreply.github.com> | 2023-03-22 02:51:57 +0000 |
| commit | 14dc3c624760eba9bafea21aaee403fcd216ad65 (patch) | |
| tree | ea538f7222cdae6746441be0b96b4b7a6797f1e2 /user-programs | |
| parent | Fix printing back of index card (diff) | |
| download | folk-14dc3c624760eba9bafea21aaee403fcd216ad65.tar.gz folk-14dc3c624760eba9bafea21aaee403fcd216ad65.zip | |
initial tests of wishes to create web endpoints
Diffstat (limited to 'user-programs')
| -rw-r--r-- | user-programs/folk-haip.local/web-endpoints.folk | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/user-programs/folk-haip.local/web-endpoints.folk b/user-programs/folk-haip.local/web-endpoints.folk new file mode 100644 index 00000000..2d239197 --- /dev/null +++ b/user-programs/folk-haip.local/web-endpoints.folk @@ -0,0 +1,20 @@ +Wish the Web server handles route "/static-html/$" with handler { + set html "<h1>Hello World!</h1>" +} + +Wish the Web server handles route "/score/$" with handler { + set response [dict create contentType "application/json" body "{\"score\": 5}"] +} + +When /program/ has region /region/ { + Wish the Web server handles route "/region/$" with handler { + # We are currently missing $region from being in scope + set html "<h1>[info vars]</h1>" + } +} + +Wish the Web server handles route {/pagee/(\d*)$} with handler { + if {[regexp -all {/pagee/(\d*)$} $path whole_match pageNumber]} { + set html "<h1>Hello Page Number $pageNumber</h1>" + } +} |
