Ruby / Sinatra - serving up css, javascript, or image files

前端 未结 2 1722
北恋
北恋 2020-12-14 00:56

What is the correct way to route your request through Sinatra so that it serves up the file with no processing? I\'m looking for the most common way people do this in the Si

2条回答
  •  北荒
    北荒 (楼主)
    2020-12-14 01:32

    get '/notes/images/:file' do
      send_file('/root/dev/notes/images/'+params[:file], :disposition => 'inline')
    end
    

提交回复
热议问题