Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to set port for Rack app?

Tags:

ruby

rack

builder.rb:

def app
  Rack::Builder.new do
    run App.new
  end.to_app
end

How to run on a given port?

like image 925
B Seven Avatar asked Sep 15 '15 20:09

B Seven


2 Answers

Try:

Rack::Handler.default.run(app, :Port => 3000)

Although it would be more typical to run your app in a config.ru file and specify port as a command line option to rackup, e.g.: rackup -p 3000.

like image 180
Jacob Brown Avatar answered Oct 11 '22 13:10

Jacob Brown


When you rackup just specify it with option -p so:

rackup -p 8808 would work just fine.

like image 23
Michael K Madison Avatar answered Oct 11 '22 15:10

Michael K Madison