Skip to content

Instantly share code, notes, and snippets.

@mascarenhas
Created October 30, 2009 19:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mascarenhas/222642 to your computer and use it in GitHub Desktop.
Save mascarenhas/222642 to your computer and use it in GitHub Desktop.
#!/usr/bin/env wsapi.cgi
require "orbit"
require "orbit.routes"
local R = orbit.routes.R
local hello = orbit.new()
hello:dispatch_get(function (web)
return string.format('<h1>Welcome to %s!</h1>', web.real_path)
end, R'/')
hello:dispatch_get(function(web, params)
return string.format('Hello %s!', params.name)
end, R'/hello/:name')
hello:dispatch_get(function(web, params)
return string.format('Hi %s!', params.splat[1])
end, R'/hi/*')
hello:dispatch_get(function(web, params)
return string.format('Hey %s!', params.name or "stranger")
end, R'/hey/?:name?')
return hello
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment