--- --- Generated by EmmyLua(https://github.com/EmmyLua) --- Created by admin. --- DateTime: 2025/9/24 15:29 --- local radix = require("resty.radixtree") local userApi = require("api.system.user") local routes = { { paths = { "/api/user" }, metadata = { "metadata /user" }, methods = { "GET", "POST" }, handler = userApi.get_allusers, }, { paths = { "/api/user/:id" }, metadata = { "metadata /user/id" }, methods = { "GET", "PUT", "DELETE" }, handler = userApi.get_users, }, { paths = { "/api/admin/:name", "/api/superuser/:name" }, metadata = { "metadata /admin/name" }, methods = { "GET", "POST", "PUT" }, filter_fun = function(vars, opts) return vars["arg_access"] == "admin" end } } local rx, err = radix.new(routes) if not rx then ngx.say("-----") ngx.status = 404 ngx.say("Not Found") --ngx.exit() end local uri = ngx.var.uri local opts = { method = ngx.var.request_method, matched = {} } local ok = rx:dispatch(uri, opts, opts.matched) if not ok then ngx.status = 404 ngx.say("Not Found") --ngx.exit() end