Commit 261773c7d7384db71d05f9b53440e82bda83b684

Baptiste 2024-08-06T20:40:04

httpd: routes: wip

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
diff --git a/lib/kc3/0.1/httpd.kc3 b/lib/kc3/0.1/httpd.kc3
index 1f207e1..4ebbc62 100644
--- a/lib/kc3/0.1/httpd.kc3
+++ b/lib/kc3/0.1/httpd.kc3
@@ -78,8 +78,15 @@ defmodule HTTPd do
     %HTTP.Response{code: 404, body: body}
   }
 
+  def root_dir = "."
+
   def route_request = fn (request) {
-    error_404_page
+    path = root_dir + request.url
+    if File.exists?(path) do
+      debug_page
+    else
+      error_404_page
+    end
   }
 
 end