我有一个仅使用 HTML、CSS 和 JavaScript 的一页网站。我想将应用程序部署到 Heroku,但我找不到方法。我现在正在尝试使该应用程序与 Sinatra 一起使用。
.
|-- application.css
|-- application.js
|-- index.html
|-- jquery.js
`-- myapp.rb
而下面的内容就是myapp.rb
.
require 'rubygems'
require 'sinatra'
get "/" do
# What should I write here to point to the `index.html`
end
您可以使用send_file
提供文件服务的助手。
require 'sinatra'
get '/' do
send_file File.join(settings.public_folder, 'index.html')
end
这将服务index.html
从任何已配置为包含应用程序静态文件的目录。
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)