Skip to content
This repository was archived by the owner on Dec 11, 2020. It is now read-only.
This repository was archived by the owner on Dec 11, 2020. It is now read-only.

demo #30

@JamesJoe-C

Description

@JamesJoe-C

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions