Skip to content

Instantly share code, notes, and snippets.

@UsamaAshraf
Created May 4, 2018 04:20
Show Gist options
  • Save UsamaAshraf/2ba22d676c611a6cd21c39a4a1175541 to your computer and use it in GitHub Desktop.
Save UsamaAshraf/2ba22d676c611a6cd21c39a4a1175541 to your computer and use it in GitHub Desktop.
Register a custom Rails middleware
# config/environments/development.rb
# …
# Add our own middleware before the ActionDispatch::Static
# middleware and pass it an array of service worker URIs as a
# parameter.
config.middleware.insert_before ActionDispatch::Static, ServiceWorkerManager, ['service-worker.js']
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment