initial implementation of mlua for loading plugins, see todo.md in examples

This commit is contained in:
2026-04-27 14:53:24 +02:00
parent fe48b74edc
commit 77e80c990c
10 changed files with 278 additions and 54 deletions
+18
View File
@@ -0,0 +1,18 @@
-- example plugin for http-rs ; using current api
print("type(router) = " .. type(router))
print("router = ", router)
router:add_file_server("/uploads", "./uploaded_files")
router:add_static("/api/status", 200, '{"status":"ok","version":"1.0"}', "application/json")
print("Lua plugin loaded with the following arguments:")
for i, v in ipairs(args) do
print(" arg[" .. i .. "] = " .. tostring(v))
end
if args[1] == "debug" then
router:add_static("/debug", 200, "Debug mode active", "text/plain")
print("Debug endpoint added at /debug")
end