我想知道哪种方法可以更好地为 ruby 安装不同的应用程序。我有 2 个 sinatra 应用程序和一个 rails 应用程序。
一种方法是使用 rails 作为基础并使用routes.rb
(within rails)安装 sinatra 应用程序
RailsApp::Application.routes.draw do
mount SinatraApp1, :at => "/url1"
mount SinatraApp2, :at => "/url2"
# rest of the rail routes
end
这样,两个 sinatra 应用程序都在 rails 中。
另一种方法是使用 rackup 来安装所有三个使用config.ru
(所有三个应用程序并行)
map "/" do
run RailsApp::Application
end
map "/url1" do
run SinatraApp1
end
map "/url2" do
run SinatraApp2
end
我无法找到一种优于另一种的优势,或者出于什么原因哪种方法更好。