Static page routing in Sinatra (Ruby)

前端 未结 6 857
醉酒成梦
醉酒成梦 2021-02-13 13:39

You can serve static files with Sinatra by placing them in public/ (by default) -- I have an index.html in there at the moment, but how can I make the

6条回答
  •  情歌与酒
    2021-02-13 14:29

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

    As described at Serving static files with Sinatra

提交回复
热议问题