annotate mod_http_libjs/mod_http_libjs.lua @ 4094:dd00a2b9927c

mod_invites_page: New module to generate landing page for invites
author Matthew Wild <mwild1@gmail.com>
date Fri, 11 Sep 2020 13:52:32 +0100
parents 88a469b285f5
children de2390d6bbe4
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
4087
88a469b285f5 mod_http_libjs: New module to serve common CSS/Javascript libraries
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
1 local mime_map = module:shared("/*/http_files/mime").types or {
88a469b285f5 mod_http_libjs: New module to serve common CSS/Javascript libraries
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
2 css = "text/css",
88a469b285f5 mod_http_libjs: New module to serve common CSS/Javascript libraries
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
3 js = "application/javascript",
88a469b285f5 mod_http_libjs: New module to serve common CSS/Javascript libraries
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
4 };
88a469b285f5 mod_http_libjs: New module to serve common CSS/Javascript libraries
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
5
88a469b285f5 mod_http_libjs: New module to serve common CSS/Javascript libraries
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
6 local libjs_path = module:get_option_string("libjs_path", "/usr/share/javascript");
88a469b285f5 mod_http_libjs: New module to serve common CSS/Javascript libraries
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
7
88a469b285f5 mod_http_libjs: New module to serve common CSS/Javascript libraries
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
8 module:provides("http", {
88a469b285f5 mod_http_libjs: New module to serve common CSS/Javascript libraries
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
9 default_path = "/share";
88a469b285f5 mod_http_libjs: New module to serve common CSS/Javascript libraries
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
10 route = {
88a469b285f5 mod_http_libjs: New module to serve common CSS/Javascript libraries
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
11 ["GET /*"] = require "net.http.files".serve({ path = libjs_path, mime_map = mime_map });
88a469b285f5 mod_http_libjs: New module to serve common CSS/Javascript libraries
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
12 }
88a469b285f5 mod_http_libjs: New module to serve common CSS/Javascript libraries
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
13 });