Created
March 18, 2012 19:15
-
-
Save ox/2079960 to your computer and use it in GitHub Desktop.
ruby_benchmarker for pissing contest
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'sinatra' | |
require 'sequel' | |
# $ gem install thin mysql sequel | |
# the mysql gem is a MASSIVE pain in the ass, would rather | |
# use something saner like Postgres or Mongo or Redis | |
# thin is required, WEBRick is terrible | |
set :server, :thin | |
get '/' do | |
'Hello World' | |
end | |
get '/db' do | |
Sequel.connect('mysql://root@localhost:3306/DB') do |db| | |
stream do |out| | |
db[:users].each do |user| | |
out << user + '\n' | |
end | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment