tchoutchou/examples/multipart.lua
2023-02-18 23:31:58 +01:00

23 lines
566 B
Lua

print([[
===============================================================================
examples:
===============================================================================
curl -F "test=@README.md" localhost:3000/submit
===============================================================================
]])
local app = create_app()
app:post("/", function(req, res)
if req.parts.test == nil then
res.status = 400
res.body = "Missing myfile field"
return res
end
fs:write("yololo.txt", req.parts.test.content)
return res
end)
app:run(3000)