花椒直播Kong应用实践
local BasePlugin = require “kong.plugins.base_plugin”
— The actual logic is implemented in those modules
local access = require “kong.plugins.my-custom-plugin.access”
local body_filter = require “kong.plugins.my-custom-plugin.body_filter”
local CustomHandler = BasePlugin:extend()
function CustomHandler:new()
CustomHandler.super.new(self, “my-custom-plugin”)
end
function CustomHandler:access(config)
CustomHandler.super.access(self)
— Execute any function from the module loaded in access
,
— for example, execute()
and passing it the plugin’s configuration.
access.execute(config)
end
function CustomHandler:body_filter(config)
CustomHandler.super.body_filter(self)
— Execute any function from the module loaded in body_filter
,
— for example, execute()
and passing it the plugin’s configuration.
body_filter.execute(config)
end
return CustomHandler