Skip to content

Instantly share code, notes, and snippets.

@burke
Created March 30, 2009 00:07
Show Gist options
  • Save burke/87578 to your computer and use it in GitHub Desktop.
Save burke/87578 to your computer and use it in GitHub Desktop.
#!/usr/bin/env ruby
$LOAD_PATH << "/home/student/umlibbey/lib"
ENV['GEM_HOME'] = "/home/student/umlibbey/gems"
require 'rubygems'
require 'rack'
require 'cloudkit'
app = Rack::Builder.new do
use Rack::CommonLogger
use Rack::Lint
use CloudKit::Service, :collections => [:events, :users]
use Rack::Static, :urls => ["/assets", "/index.html"], :root => "public"
run (lambda do |env|
if env["PATH_INFO"] == "/"
# Redirect to index.html.
[301, {"Location" => "index.html", "Content-Type" => "text/html", "Content-Length" => "0"}, []]
else
# Not found.
[404, {"Content-Type" => "text/html", "Content-Length" => "9"}, ["Not Found"]]
end
end)
end
Rack::Handler::WEBrick.run app, :Port => 15021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment