diff options
author | Kim Alvefur <zash@zash.se> | 2012-12-21 20:40:29 +0100 |
---|---|---|
committer | Kim Alvefur <zash@zash.se> | 2012-12-21 20:40:29 +0100 |
commit | 29bdb62b65aa7dd94af9f90a31a00b004d24e4fb (patch) | |
tree | 6593a177aee8edc7178e3c3da98b2ad8c7b860eb /plugins | |
parent | 0865e342682e3a9980822c9a9233f63a067a4e33 (diff) | |
download | prosody-29bdb62b65aa7dd94af9f90a31a00b004d24e4fb.tar.gz prosody-29bdb62b65aa7dd94af9f90a31a00b004d24e4fb.zip |
mod_http_files: Expose function other modules can use to combine their routes with file paths to serve
Diffstat (limited to 'plugins')
-rw-r--r-- | plugins/mod_http_files.lua | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/plugins/mod_http_files.lua b/plugins/mod_http_files.lua index 311b3a4b..a96db7b6 100644 --- a/plugins/mod_http_files.lua +++ b/plugins/mod_http_files.lua @@ -126,6 +126,14 @@ function serve(opts) return serve_file; end +function wrap_route(routes) + for route,handler in pairs(routes) do + if type(handler) == "table" and handler.path then + routes[route] = serve(handler); + end + end + return routes; +end if base_path then module:provides("http", { |