Estoy tratando de obtener información de este tutorial: http://m.onkey.org/2008/11/18/ruby-on-rack-2-rack-builderRubí Rack - montar un servidor web simple que lee index.html por defecto
básicamente quiero tener un archivo config.ru
que diga estante para leer la corriente directorio para que pueda acceder a todos los archivos como un simple servidor apache y también leer la raíz predeterminada con el archivo index.html ... ¿hay alguna manera de hacerlo?
mi actual config.ru
se parece a esto:
run Rack::Directory.new('')
#this would read the directory but it doesn't set the root to index.html
map '/' do
file = File.read('index.html')
run Proc.new {|env| [200, {'Content-Type' => 'text/html'}, file] }
end
#using this reads the index.html mapped as the root but ignores the other files in the directory
Así que no sé cómo proceder de aquí ...
También he probado esta siguiendo el ejemplo tutoriales pero thin
doesn' t comienza correctamente
builder = Rack::Builder.new do
run Rack::Directory.new('')
map '/' do
file = File.read('index.html')
run Proc.new {|env| [200, {'Content-Type' => 'text/html'}, file] }
end
end
Rack::Handler::Thin.run builder, :port => 3000
Gracias de antemano
FWIW, ': port => 3000' debe ser': Port => 3000' - tenga en cuenta la "P" mayúscula en el puerto. – briangonzalez