| |
|
|
| |
| |
| |
| |
| local uri = ngx.var.uri |
|
|
| local api_version = '' |
| local api_pxoxy_pass_url_indicator = '' |
|
|
| |
| if uri == '/' then |
| ngx.exit(ngx.HTTP_OK) |
| end |
|
|
| local api_version, api_pxoxy_pass_url_indicator = uri:match("/?([^/]+)/?(.*)") |
|
|
| ngx.say("api_version: ", api_version) |
| ngx.say("api_pxoxy_pass_url_indicator: ", api_pxoxy_pass_url_indicator) |
| pass_url = api_pxoxy_pass_url_indicator |
| |
| |
| pass_url = pass_url:gsub("http/", "http://") |
| pass_url = pass_url:gsub("https/", "https://") |
| ngx.say("pass_url: ", pass_url) |
|
|
| |
| |
| |
| |
| local lua_path = "app/" ..api_version .. "/app" |
| ngx.say("lua_path: ", lua_path) |
| module = require("app/" .. api_version .. "/app") |
|
|
|
|
| |
| if type(module) ~= "table" then |
| ngx.say("Error: Failed to load module") |
| ngx.exit(ngx.HTTP_INTERNAL_SERVER_ERROR) |
| end |
|
|
| |
| module.some_function() |
| module.another_function() |
|
|
|
|
| ngx.say("module.a: ", module.a) |
|
|