I am having a url '/gifts/' below is code of nginx.conf file which is managing logic.
location /gifts {
default_type text/html;
set $target '';
content_by_lua '
local redis = require "resty.redis";
local red = redis:new()
red:set_timeout(1000) -- 1 sec
local ok, err = red:connect("127.0.0.1", 6379)
if not ok then
ngx.log(ngx.ERR, err, "Redis failed to connect")
return ngx.exit(ngx.HTTP_SERVICE_UNAVAILABLE)
end
local ok1, err = red:set("Animal", "DOG")
if not ok then
ngx.say("Failed to set cache in redis", err)
end
local res, err = red:get("Animal")
if not res then
ngx.say("Failure", err)
end
ngx.say("Animal", res)
';
}
It is working fine for me with /gifts/
But i have one requirement like i want to fetch parameters into this login like
/gifts?key=name&value=Prashant
I want to fetch value of key and value.