Comparison

plugins/mod_http_files.lua @ 5265:cc2aed452a62

mod_http_files: Expose function other modules can use to combine their routes with file paths to serve
author Kim Alvefur <zash@zash.se>
date Fri, 21 Dec 2012 20:40:29 +0100
parent 5264:700ff21a0451
child 5268:69964d1cbe66
comparison
equal deleted inserted replaced
5264:700ff21a0451 5265:cc2aed452a62
124 end 124 end
125 125
126 return serve_file; 126 return serve_file;
127 end 127 end
128 128
129 function wrap_route(routes)
130 for route,handler in pairs(routes) do
131 if type(handler) == "table" and handler.path then
132 routes[route] = serve(handler);
133 end
134 end
135 return routes;
136 end
129 137
130 if base_path then 138 if base_path then
131 module:provides("http", { 139 module:provides("http", {
132 route = { 140 route = {
133 ["GET /*"] = serve { 141 ["GET /*"] = serve {