summaryrefslogtreecommitdiffstats
path: root/user-programs
diff options
context:
space:
mode:
authorJacob Haip <jhaip@users.noreply.github.com>2023-03-22 02:51:57 +0000
committerJacob Haip <jhaip@users.noreply.github.com>2023-03-22 02:51:57 +0000
commit14dc3c624760eba9bafea21aaee403fcd216ad65 (patch)
treeea538f7222cdae6746441be0b96b4b7a6797f1e2 /user-programs
parentFix printing back of index card (diff)
downloadfolk-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.folk20
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>"
+ }
+}