[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Site Programing
- From: PA <petite.abeille@...>
- Date: Mon, 17 Sep 2007 18:03:15 +0200
On Sep 17, 2007, at 10:15, Daniel Silverstone wrote:
I don't know Spanish nor Portugese but if you want to use Lua for web
programming you should check out the Kepler project at
http://www.keplerproject.org
Or Aranha (which is differently focussed and nowhere near as complete)
which might fit better your requirements.
http://www.digital-scurf.org/software/aranha
Or, while we are at it, HTTP.lua, which is 100% pure Lua at its core:
http://dev.alt.textdrive.com/browser/HTTP/HTTP.lua
Canonical 'Hello world' example:
local HTTP = require( 'HTTP' ) --import the HTTP module
HTTP[ '/hello(%a*)' ] = function( aName ) return 'Hello ' .. ( aName or
'world' ) end -- define a handler
HTTP() -- run the HTTP server
% lua Hello.lua
GET /hello HTTP/1.1
HTTP/1.1 200 OK
Date: Mon, 17 Sep 2007 15:54:26 GMT
Content-Type: text/html; charst=utf-8
Content-Length: 11
Connection: keep-alive
Hello world
Using D. J. Bernstein's tcpserver [1]:
% ./tcpserver 0 1080 lua Hello.lua&
% telnet localhost 1080
Trying 127.0.0.1...
Connected to localhost.
Escape character is '^]'.
GET /helloyou HTTP/1.1
HTTP/1.1 200 OK
Date: Mon, 17 Sep 2007 16:01:21 GMT
Content-Type: text/html; charst=utf-8
Content-Length: 9
Connection: keep-alive
Hello you
That said, you might be better off using something more mainstream,
such as CGILua:
http://www.keplerproject.org/cgilua/
Cheers,
PA.
[1] http://cr.yp.to/ucspi-tcp/tcpserver.html