Skip to content

Instantly share code, notes, and snippets.

@nrk
Created August 17, 2010 08:06
Show Gist options
  • Select an option

  • Save nrk/528897 to your computer and use it in GitHub Desktop.

Select an option

Save nrk/528897 to your computer and use it in GitHub Desktop.
Redis + mercury + luapages (tiny example)
require 'luarocks.require'
require 'mercury'
require 'redis'
module('redis_app', package.seeall, mercury.application)
local templates = {
index = [[
<html>
<head>
<title>Redis</title>
</head>
<body>
<ul>
<% for key, value in pairs(redis:info()) do %>
<li><%= key %> => <%= tostring(value) %></li>
<% end %>
</ul>
</body>
</html>
]]
}
get('/', function()
t.lp(templates.index, { redis = Redis.connect() })
end)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment