aboutsummaryrefslogtreecommitdiff
path: root/tests/net.lua
diff options
context:
space:
mode:
authorame <[email protected]>2024-01-26 14:59:41 -0600
committerame <[email protected]>2024-01-26 14:59:41 -0600
commitbafa906b6c51064e9ab429f81666feaf4c9e1740 (patch)
tree2522edf8f7ae5b11a6d821cc37799b3bbf9eee35 /tests/net.lua
parent39f9aa57e59ed2311b785c83cd3d07e5eeb5fb26 (diff)
testing multithreading
Diffstat (limited to 'tests/net.lua')
-rw-r--r--tests/net.lua31
1 files changed, 31 insertions, 0 deletions
diff --git a/tests/net.lua b/tests/net.lua
new file mode 100644
index 0000000..af8ef6e
--- /dev/null
+++ b/tests/net.lua
@@ -0,0 +1,31 @@
+require "llib"
+llib.config.set({max_depth=5})
+--local print = llib.io.pprint
+function sleep (a)
+ local sec = tonumber(os.clock() + a);
+ while (os.clock() < sec) do
+ end
+end
+llib.io.pprint(llib.net.listen(
+ function(server)
+ print("wowa")
+
+ llib.io.pprint(server:GET("/", function(res, req)
+ --llib.io.pprint(res)
+ --llib.io.pprint(res)
+ --print(res.send)
+ --res:send("hi");
+ --res.Code = 201
+ sleep(1)
+ res:send("<h2>hello world</h2>")
+ end))
+
+ llib.io.pprint(server:GET("/test", function(res, req)
+ res.Code = 403
+ res:send("<h2>you would never</h2>")
+ end))
+
+
+ end,
+ 8080
+)) \ No newline at end of file