lua-users home
lua-l archive

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

On Tue, Feb 8, 2011 at 6:41 AM, steve donovan <> wrote:
On Mon, Feb 7, 2011 at 10:21 PM, Petite Abeille
<> wrote:
> While we are at it, here are my very own 500 lines worth of dinky HTTP server... and it doesn't even need LuaSocket :P

Man, that is such cool code that I don't understand how it actually
works ;)  In particular, how does it do the basic networking layer?

> HTTP[ '/' ] = function() return 'Hello world' end HTTP()

Nice notation..

In a similar vein, I knocked out a (quick and dirty) route-based [*] framework prototype last year. If you're interested, see

The tarball includes a simple site as proof of concept. Here's an excerpt,

get["/f"]   = function()
  return template("form.tmpl.html", {
    title = "Form"

post["/p"]  = function(posted)
  return template("form_reply.tmpl.html", {
    query = posted.query,
    title = "Reply"

To test it out, just run "lua t1.lua" -- you'll need xavante installed.

The templating engine is trivial at present, though I envisage (as with Dancer) the ability to drop in a third party implementation.

Any feedback is welcome!


[*] See and for more info.