summary refs log tree commit diff
diff options
context:
space:
mode:
authorAshelyn Rose <git@ashen.earth>2025-05-10 00:40:11 -0600
committerAshelyn Rose <git@ashen.earth>2025-05-10 00:40:11 -0600
commit0f1be782d83700aef53d8953b08fe2a6c5d807e1 (patch)
treeb80285e1c9c8c4b3cba3ecc5f1559c2c6d3f99ec
parent55c69af4c5bdc93f923e4c6c8e521eab2b7fc2b0 (diff)
Handle invalid routes
-rw-r--r--index.js2
1 files changed, 1 insertions, 1 deletions
diff --git a/index.js b/index.js
index 294ad72..84899f0 100644
--- a/index.js
+++ b/index.js
@@ -103,7 +103,7 @@ createServer(async (req, res) => {
     },
   }
 
-  const handler = routes[method][url]
+  const handler = routes?.[method]?.[url]
 
   if (!handler) {
     res.writeHead(404).end('Not found')