How to set port for Rack app?

邮差的信 提交于 2020-04-10 03:27:05

问题


builder.rb:

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

How to run on a given port?


回答1:


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.




回答2:


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

rackup -p 8808 would work just fine.



来源:https://stackoverflow.com/questions/32594945/how-to-set-port-for-rack-app

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!