jsonpath/lua/docker_example/default.conf

32 lines
814 B
Plaintext
Raw Normal View History

2019-08-23 22:09:09 +09:00
lua_package_path '/etc/jsonpath/?.lua;;';
access_log /var/log/nginx_access.log;
2019-08-23 22:09:09 +09:00
error_log /var/log/nginx_error.log info;
server {
listen 80;
server_name localhost;
location /0 {
2019-08-23 22:09:09 +09:00
default_type text/html;
content_by_lua '
local jsonpath = require("jsonpath")
jsonpath.init("/etc/jsonpath/libjsonpath_lib.so")
local data = ngx.location.capture("/example.json")
local template = jsonpath.compile("$..book[?(@.price<30 && @.category==\'fiction\')]")
local result = template(data.body)
ngx.say(result)
';
}
location /1 {
default_type text/html;
content_by_lua_file /etc/jsonpath/testa.lua;
}
2019-08-23 22:09:09 +09:00
location /example {
root /etc/jsonpath/example;
}
}