Skip to content

Instantly share code, notes, and snippets.

@Poincare
Created September 10, 2012 22:50
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 Poincare/3694526 to your computer and use it in GitHub Desktop.
Save Poincare/3694526 to your computer and use it in GitHub Desktop.
require "cuba"
Cuba.use Rack::Session::Cookie
Cuba.define do
on get do
on "hello" do
res.write "Hello world!"
end
on "echo/:string" do |string|
res.write string
end
on "print", param("p") do |string|
res.write string
end
on root do
res.redirect "/hello"
end
end
on.post do
on "api" do
res.write '{"error" : "no api yet"}'
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment