gpt4 book ai didi

ruby - 如何在 Windows 上使用 Thin 启动和停止 Sinatra 应用程序?

转载 作者:可可西里 更新时间:2023-11-01 13:18:37 28 4
gpt4 key购买 nike

class App < Sinatra::Base
def hello
"world"
end
end

从文档中我发现我可以像这样启动应用程序:

App.run

尽管这不会返回控制权。

如何在后台启动应用程序以及如何停止它。

我的环境是:Windows,Ruby 1.9.2

最佳答案

使用 Dmitry Maksimov 建议的 config.ru 文件:

#config.ru
require './your_app_file'

run YourApp

然后从 rackup -D 开始,这意味着 deamonize,因此它在后台运行。

不过,我不建议将其用于开发。最好看看 Shotgun

关于ruby - 如何在 Windows 上使用 Thin 启动和停止 Sinatra 应用程序?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5075135/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com