]> Untitled Git - godot-builder.git/blob - hook/example.lua
Updated prod compose file
[godot-builder.git] / hook / example.lua
1 require "apache2"
2 require "string"
3
4 --[[
5      This is the default method name for Lua handlers, see the optional
6      function-name in the LuaMapHandler directive to choose a different
7      entry point.
8 --]]
9 function handle(r)
10     r.content_type = "text/plain"
11
12     if r.method == 'GET' then
13         r:puts("Hello Lua World!\n")
14         for k, v in pairs( r:parseargs() ) do
15             r:puts( string.format("%s: %s\n", k, v) )
16         end
17     elseif r.method == 'POST' then
18         r:puts("Hello Lua World!\n")
19         for k, v in pairs( r:parsebody() ) do
20             r:puts( string.format("%s: %s\n", k, v) )
21         end
22     elseif r.method == 'PUT' then
23 -- use our own Error contents
24         r:puts("Unsupported HTTP method " .. r.method)
25         r.status = 405
26         return apache2.OK
27     else
28 -- use the ErrorDocument
29         return 501
30     end
31     return apache2.OK
32 end