Skip to content

Instantly share code, notes, and snippets.

### Keybase proof
I hereby claim:
* I am lfv89 on github.
* I am lfv89 (https://keybase.io/lfv89) on keybase.
* I have a public key ASC8wxldsLmXlwxajFAuZi9B4ppzEC3HJwNl1crQxy3dpgo
To claim this, I am signing this object:
@lfv89
lfv89 / server.rb
Created October 14, 2018 00:18
hello world with puma on rack
require 'bundler/inline'
gemfile do
source 'https://rubygems.org'
gem 'rack'
gem 'puma'
end
require 'rack/handler/puma'
@lfv89
lfv89 / server.rb
Created October 13, 2018 23:58
hello world with thin on rack
require 'bundler/inline'
gemfile do
source 'https://rubygems.org'
gem 'rack'
gem 'thin'
end
class ThinRackApp
def call(env)
@lfv89
lfv89 / server.rb
Created October 13, 2018 23:52
hello world with mongrel on rack
require 'bundler/inline'
gemfile do
source 'https://rubygems.org'
gem 'rack', '1.6.10'
gem 'mongrel', '1.2.0.pre2'
end
class MongrelRackApp
def call(env)
@lfv89
lfv89 / server.rb
Created October 13, 2018 23:42
hello world with webrick on rack
require 'bundler/inline'
gemfile do
source 'https://rubygems.org'
gem 'rack'
end
class WebrickRackApp
def call(env)
['200', {'Content-Type' => 'text/html'}, ['Hello, World!']]
@lfv89
lfv89 / server.rb
Last active October 13, 2018 16:22
hello world with webrick
require 'webrick'
server = WEBrick::HTTPServer.new(:Port => 3000)
server.mount_proc '/' do |req, res|
res.body = 'Hello, World!'
end
server.start
@lfv89
lfv89 / server.rb
Last active October 13, 2018 16:22
hello world with mongrel
require 'bundler/inline'
gemfile do
source 'https://rubygems.org'
gem 'mongrel', '1.2.0.pre2'
end
class BasicHttpHandler < Mongrel::HttpHandler
def process(request, response)
response.start(200) do |head, output|
@lfv89
lfv89 / server.rb
Last active October 14, 2018 18:35
hello world with thin
require 'bundler/inline'
gemfile do
source 'https://rubygems.org'
gem 'thin'
end
# literally a rack app
app = ->(env) { ['200', {'Content-Type' => 'text/html'}, ['Hello, World!']] }
Thin::Server.new('localhost', 3000, app, {}).start
@lfv89
lfv89 / server.rb
Last active October 14, 2018 18:35
hello world with puma
require 'bundler/inline'
gemfile do
source 'https://rubygems.org'
gem 'puma'
end
require 'puma/configuration'
# literally a rack app