FWIW - Apache HTTPD supports using Lua as a language, too.
http://httpd.apache.org/docs/trunk/mod/mod_lua.html
I use it for my game server. I do everything in Lua server side. Uses MOD_DBD - so you can use any datastore.
Basically, if you can do it on Apache HTTPD, you can do it with mod_lua.
What's really cool about this is since its httpd, you can throw your game server onto Heroku.
I run httpd locally with mysql under it - I use Lua Glider as my editor; and have the server files in the same editor.
I can use local file storage, etc.
Just thought I'd offer this up - Coronium could be a really nice object library to run under httpd if you saw fit. It's a heck of a lot easier than forklifting this from scratch.
The Coronium object could abstract from the storage and the presentation layer; rendering results in JSON (what I do, personally) or hand it to a view controller.
In apache, the flow happens in a function call "handle" that passes the request object in. You output to it (versus print), and return a status OK.
I do this today, now. Want to use your LUA code as REST server? See mod_rewrite.
RewriteRule ^/api.*$ /api/handler.lua?%{QUERY_STRING} [L]
Here's what the code looks like. My implementation is much more complex, but you get an idea of how easy it is.. and more importantly, flexible. You get Apache HTTPD + Lua. The rest is libraries.
function handle(req) -- Do with the request object as you see fit here -- such as lfs = require("lfs") md5 = require("md5") zip = require("zip") stringx = require("string_ext") json = require("json_pure") https = require("https") ssl = require("ssl") smtp = require("socket.smtp") ltn12 = require("ltn12") socket = require("socket") local responseData = {} responseData.verifyIwork = "Hello World!" if req.method=='GET' then responseData.value = 5 responseData.detail = {value=6, name="joe"} elseif req.method=='POST' then -- send to your data storage class here elseif req.method=='PUT' then -- take action on PUT method elseif req.method=='DELETE' then -- take action on DELETE method end req:puts( json:encode(responseData) ) return apache2.OK end
It has it's quirks, since it's a (relatively) new Apache HTTPD feature - but building on top of Apache HTTPD is likely to go a long way.
You can also do things like this:
local myfunction function myfunction(sTemp) return sTemp .. " altered" end function handle(req) local responseData = {} responseData.verifyIwork = "Hello World!" if req.method=='GET' then responseData.value = 5 responseData.detail = {value=6, name="joe"} responseData.fromFunction = myfunction("testing") end req:puts( json:encode(responseData) ) return apache2.OK end