Browse Source

Add dispatch script

main
Annwan 4 months ago
parent
commit
22ea459aaf
  1. 15
      main.lua
  2. 6
      yqtemplate.lua

15
main.lua

@ -0,0 +1,15 @@
#!/usr/bin/env lua
local fcgi = require"fcgi"
local yqtemplate = require"yqtemplate"
while fcgi.accept() do
app = fcgi.getenv("DOCUMENT_URI"):sub(6)
if app = "yqtemplate" then
yqtemplate(fcgi)
else
fcgi.print"Content-Type: text/plain; charset=utf-8\r\n\r\n"
fcgi.print("Unknown CGI application: `" .. app .. "'\n")
end
end

6
yqtemplate.lua

@ -1,5 +1,3 @@
local fcgi = require"fcgi"
while fcgi.accept() do
fcgi.print("Content-Type: text/plain; charset=utf-8\r\n\r\n")
fcgi.print("Hello from" .. fcgi.getenv("DOCUMENT_URI") .. "\n")
return function(fcgi)
fcgi.print"Hello from application `YQTemplate'"
end
Loading…
Cancel
Save