From 29bdb62b65aa7dd94af9f90a31a00b004d24e4fb Mon Sep 17 00:00:00 2001 From: Kim Alvefur Date: Fri, 21 Dec 2012 20:40:29 +0100 Subject: mod_http_files: Expose function other modules can use to combine their routes with file paths to serve --- plugins/mod_http_files.lua | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'plugins') 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", { -- cgit v1.2.3