aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKim Alvefur <zash@zash.se>2012-12-21 20:40:29 +0100
committerKim Alvefur <zash@zash.se>2012-12-21 20:40:29 +0100
commit4130b38a58a4065d7157be93b47fce98fce6ab0e (patch)
tree6593a177aee8edc7178e3c3da98b2ad8c7b860eb
parent87cf947c6c9255777c55fd07450ea74fbb97bfc7 (diff)
downloadprosody-4130b38a58a4065d7157be93b47fce98fce6ab0e.tar.gz
prosody-4130b38a58a4065d7157be93b47fce98fce6ab0e.zip
mod_http_files: Expose function other modules can use to combine their routes with file paths to serve
-rw-r--r--plugins/mod_http_files.lua8
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", {