robin/maivi

a tiny cute lua web framework

git clone https://git.robinwobin.dev/robin/maivi

robinmaivi: implement redirects as a plugin90f03ce

push-srxvuswpkqxx
240 B12 linesraw
1local paths = {
2  ["^/wiwiwi"] = "/wawawa",
3}
4
5maivi.hook("handle", {}, function(ctx)
6  for k, v in pairs(paths) do
7    local str, n = string.gsub(ctx.path, k, v, 1)
8    if n == 1 then
9      return ctx:redirect(str, nil)
10    end
11  end
12end)