Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added make-clack-middleware #23

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

BnMcGn
Copy link

@BnMcGn BnMcGn commented Jul 28, 2020

Using clack's :mount middleware to insert a snooze app in an existing
clack application doesn't work too well. Clack modifies the :path-info
field but snooze's make-clack-app reads from :request-uri. Fixing that
requires reassembling the URL from :path-info, :query-string, etc.

Adding make-clack-middleware is a simpler, cleaner solution.

Using clack's :mount middleware to insert a snooze app in an existing
clack application doesn't work too well. Clack modifies the :path-info
field but snooze's make-clack-app reads from :request-uri. Fixing that
requires reassembling the URL from :path-info, :query-string, etc.
Adding make-clack-middleware is a simpler, cleaner solution.
@joaotavora
Copy link
Owner

This is interesting, I like that it's a full solution with support in the README.md, but I don't have a lot of time to analyse, and I have no idea what a "middleware" is. I'll just ask: why would someone need make-clack-app after this? Why not remove it, or at least deprecate it by "unmentioning" it in the README?

In another approach, wouldn't "reworking" make-clack-app work? Or is an "app" drastically different from a "middleware"?

@BnMcGn
Copy link
Author

BnMcGn commented Jul 28, 2020 via email

@mdbergmann
Copy link

Apps aren't too drastically different from middleware.

I was also completely confused by the term "middleware" and how it's used.
"Middleware" in a layered software is a middle layer, or an adapter layer.
The usage in Clack kind of more like a decorator pattern.

@BnMcGn
Copy link
Author

BnMcGn commented Jul 29, 2020 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants