Serving static files with Sinatra

后端 未结 14 1754
渐次进展
渐次进展 2020-11-29 16:38

I have one page website only using HTML, CSS and JavaScript. I want to deploy the app to Heroku, but I cannot find a way to do it. I am now trying to make the app working wi

14条回答
  •  抹茶落季
    2020-11-29 16:54

    You can use the send_file helper to serve files.

    require 'sinatra'
    
    get '/' do
      send_file File.join(settings.public_folder, 'index.html')
    end
    

    This will serve index.html from whatever directory has been configured as having your application's static files.

提交回复
热议问题