Sto cercando di ottenere alcune informazioni da questo tutorial: http://m.onkey.org/2008/11/18/ruby-on-rack-2-rack-builderRubino Rack - il montaggio di un semplice server web che legge index.html come predefinito
fondamentalmente voglio avere un file config.ru
che raccontano cremagliera per leggere la corrente directory in modo da poter accedere a tutti i file come un semplice server Apache e leggere anche la root di default con il file index.html ... c'è un modo per farlo?
mio attuale config.ru
assomiglia a questo:
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
Quindi non so come procedere da qui ...
Ho anche provato questo seguendo l'esempio tutorial ma thin
doesn' t inizia correttamente.
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
Grazie in anticipo
FWIW, ': port => 3000' dovrebbe essere': Port => 3000' - nota la "P" maiuscola in Port. – briangonzalez