Lua Handler File
I just ran into a scenario where I want a Lua handler, but I don't want to put it in the server conf.
For example, I have an app that lives at /crud/ and I want /crud/email/ to be a REST endpoint. It needs to respond to /crud/email/5 and so on. This is not currently feasible with the file-based approach, but I much prefer files because I can have multiple distinct webapps that don't rely upon the server config.
I'm wondering if it would be feasible to have something like handler.lua as a supported way of responding to requests. If the directory contains a handler.lua, all requests prefixed by the path to that directory will execute that Lua script to respond to the request. Essentially the same as index.lua but for /* instead of just /.
To restate, if you have /a/b/handler.lua then the requests /a/b/banana and /a/b/apple/3 would be handled by executing /a/b/handler.lua. Perhaps if you also have /a/b/c/handler.lua then /a/b/c/joe would execute that file instead of the more general /a/b/handler.lua.
Thought?
I think this is an excellent idea!
I also like the file-based approach, and this seems to be a good compromise. 👍
Wow, this was done in #130 that is awesome!