This is not a WSAPI script, this is an example of a script that
launches Xavante (and should be run in the terminal, not in a web
server). Try something like this "Hello World":
-------

function run(wsapi_env)
  local headers = { ["Content-type"] = "text/html" }

  local function hello_text()
    coroutine.yield("<html><body>")
    coroutine.yield("<p>Hello Wsapi!</p>")
    coroutine.yield("<p>PATH_INFO: " .. wsapi_env.PATH_INFO .. "</p>")
    coroutine.yield("<p>SCRIPT_NAME: " .. wsapi_env.SCRIPT_NAME .. "</p>")
    coroutine.yield("</body></html>")
  end

  return 200, headers, coroutine.wrap(hello_text)

end

return run

-------

--
Fabio Mascarenhas

On Wed, May 19, 2010 at 12:05 PM, Ivan Drago <ne...@yahoo.com> wrote:
>
> > Which example, and how was it run?
>
> example from Xavante manual : 
> http://keplerproject.github.com/xavante/manual.html
>
> full text:
>
> require'lfs'
> require'socket'
> require'socket.core'
> require'coxpcall'
> require'copas'
> require'xavante'
> require'lfcgi'
> require'rings'
> require'wsapi.ringer'
>
> require "xavante.filehandler"
> require "xavante.cgiluahandler"
> require "xavante.redirecthandler"
> require "xavante.patternhandler"
>
>
> -- Define here where Xavante HTTP documents scripts are located
> webDir = './site' -- XAVANTE_WEB
>
> xavante.HTTP{
> server = {host = "*", port = 8080},
>
> defaultHost = {
>
> rules = {
>
> { -- URI remapping example
> match = '^[^%./]*/$',
> with = xavante.redirecthandler,
> params = {'index.lp'}
> },
>
> { -- cgiluahandler example
> match = {"%.lp$", "%.lp/.*$", "%.lua$", "%.lua/.*$" },
> with = xavante.cgiluahandler.makeHandler(webDir)
> },
>
> { -- filehandler example
> match = ".",
> with = xavante.filehandler,
> params = {baseDir = webDir}
> },
> },
> },
>
> }
>
> xavante.start()
>
>
>
> _______________________________________________
> Kepler-Project mailing list
> Kepler-Project@lists.luaforge.net
> http://lists.luaforge.net/cgi-bin/mailman/listinfo/kepler-project
> http://www.keplerproject.org/

_______________________________________________
Kepler-Project mailing list
Kepler-Project@lists.luaforge.net
http://lists.luaforge.net/cgi-bin/mailman/listinfo/kepler-project
http://www.keplerproject.org/

Reply via email to