initial implementation of mlua for loading plugins, see todo.md in examples
This commit is contained in:
@@ -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
|
||||
Reference in New Issue
Block a user