Skip to content

Instantly share code, notes, and snippets.

@ignacio-chiazzo
Created October 13, 2021 13:41
Show Gist options
  • Save ignacio-chiazzo/13bbae47dda3134e9816b4abeb6da1b6 to your computer and use it in GitHub Desktop.
Save ignacio-chiazzo/13bbae47dda3134e9816b4abeb6da1b6 to your computer and use it in GitHub Desktop.
module Middleware
class BasicMiddleware
def initialize(app)
@app = app
end
def call(env)
# Before the app is called.
status, headers, response = @app.call(env)
# After the app is called.
[status, headers, response] # It always needs to respond with [status, header, response].
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment