Skip to content

Instantly share code, notes, and snippets.

@thilonel
Last active March 25, 2016 14:15
Show Gist options
  • Save thilonel/4ede7be17bcd86dd0606 to your computer and use it in GitHub Desktop.
Save thilonel/4ede7be17bcd86dd0606 to your computer and use it in GitHub Desktop.
media_server
require 'rack/app'
class MediaServerController < Rack::App
# this will serve files from the project root public folder
# one folder can only be mounted to one mount point. in this case '/'
serve_files_from '/public'
# this will mount the assets folder from the relative "media_server_controller" directory
# ("./media_server_controller/assets/**/*") and mount to the current controller /assets mount point
serve_files_from 'assets', to: '/assets'
# this will create static endpoints for each file in the project_root/www folder
# this will faster and mountable to the same mount point,
# with other folder mounting at the price that new content will be not served from the directory
mount_directory '/www'
end
run MediaServerController
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment