local router = require 'router'
local r = router.new()
r:match(route)
local method = ngx.var.request_method;
local post_data = "";
if(method == "POST") then
ngx.req.read_body();
local post_data = ngx.req.get_post_args();
end
local ok, errmsg = r:execute(
method,
ngx.var.request_uri,
ngx.req.get_uri_args(), -- all these parameters
post_data, -- will be merged in order
{other_arg = 1}
) -- into a single "params" table
if ok then
ngx.status = 200
else
ngx.exec("@client")
-- ngx.status = 404
-- ngx.print("Not found!")
-- ngx.log(ngx.ERROR, errmsg)
end
require("route");
local router = require 'router' local r = router.new()
r:match(route)
local method = ngx.var.request_method; local post_data = "";
if(method == "POST") then ngx.req.read_body(); local post_data = ngx.req.get_post_args(); end
local ok, errmsg = r:execute( method, ngx.var.request_uri, ngx.req.get_uri_args(), -- all these parameters post_data, -- will be merged in order {other_arg = 1} ) -- into a single "params" table
if ok then ngx.status = 200 else ngx.exec("@client") -- ngx.status = 404 -- ngx.print("Not found!") -- ngx.log(ngx.ERROR, errmsg) end