lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


> The web part of Kepler is very much in flux at the moment...

We could say Kepler is "in flux", or we could say Kepler is "very active". :)

There has been lots of things happening around Kepler (many of them
very exciting), and it might be hard to keep up (mailing list is the
way to go), but I wouldn't hold off on Kepler because of it.  The
Kepler team has been good about keeping things backwards compatible,
having clear snapshots, etc.  New releases of Kepler over the past 9
months rarely "broke" my application (and in the couple of case when
they did it was a trivial fix).  On the other hand, many of them gave
me an _opportunity_ to streamline my application.

Kepler also isn't a single thing, but rather a cluster of solutions,
and you can pick and choose between them.  In my case, I use LuaRocks
[1] for package management, install WSAPI [2] over it, and then write
my application directly on top of it, as a "WSAPI app".  This ends up
being very much "web.py" style:

    #!/usr/bin/env /home/yuri/sputnik/bin/wsapi
    require("wsapi.response")
    local run = function(wsapi_env)
       local response = wsapi.response.new()
       response:write("Hello world!")
       return response:finish()
    end
    return run

Though, to make it possible to use the same application with other
servers like Xavante, I package it as an module/luarock instead:

    #!/usr/bin/env /home/yuri/sputnik/bin/wsapi
    SPUTNIK_CONFIG = {....}  -- set a few parameters
    require("sputnik")
    return sputnik.run

Very simple, no bells and whistles.

I use Cosmo [3] for templates, but if you want something more PHP-like
you can use the "luapage" library that comes with CGILua.

On the other hand, if you want something that is more like PHP, where
your application consists of multiple pages, you can use CGILua, which
supports several ways of doing dispatching.  (See Gem 13 "MVC with
Kepler" [4]).  Finally, if you want something that is more like some
of the recent Ruby frameworks, Orbit [5] is about to be released.

 - yuri

[1] http://luarocks.org/
[2] http://wsapi.luaforge.net/
[3] http://sputnik.freewisdom.org/cosmo/
[4] http://www.keplerproject.org/papers/LuaGem13-MVC_with_Kepler_v22.zip
[5] http://orbit.luaforge.net/

-- 
http://sputnik.freewisdom.org/