tchoutchou/examples/html.lua
ato e8cdc93ebd
All checks were successful
continuous-integration/drone/push Build is passing
feat: handle content-type x-www-form-urlencoded
2023-02-14 23:10:39 +01:00

23 lines
379 B
Lua

local app = create_app()
app:get("/", function(req, res)
res.body = [[
<html>
<body>
<form action="/submit" method="post">
<input name="hello" value="Hello, World!" />
<button type="submit">submit</button>
</form>
</body>
</html>
]]
return res
end)
app:post("/submit", function(req, res)
res.body = req.form.hello
return res
end)
app:run(3000)