简体   繁体   中英

How to set port for Rack app?

builder.rb:

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

How to run on a given port?

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 , eg: rackup -p 3000 .

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

rackup -p 8808 would work just fine.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM