diff mod_http_libjs/mod_http_libjs.lua @ 4087:88a469b285f5

mod_http_libjs: New module to serve common CSS/Javascript libraries
author Matthew Wild <mwild1@gmail.com>
date Mon, 07 Sep 2020 13:33:42 +0100
parents
children de2390d6bbe4
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mod_http_libjs/mod_http_libjs.lua	Mon Sep 07 13:33:42 2020 +0100
@@ -0,0 +1,13 @@
+local mime_map = module:shared("/*/http_files/mime").types or {
+	css = "text/css",
+	js = "application/javascript",
+};
+
+local libjs_path = module:get_option_string("libjs_path", "/usr/share/javascript");
+
+module:provides("http", {
+		default_path = "/share";
+		route = {
+			["GET /*"] = require "net.http.files".serve({ path = libjs_path, mime_map = mime_map });
+		}
+	});