Discussion:
aleph server middleware
David Smith
2015-04-09 07:08:13 UTC
Permalink
Is there some way we could have a collection of aleph server middleware
that alters the response, i.e. where ring middleware does not work? There
could be a new project aleph-middleware or something, I'm sure there are
plenty of people who have written the required functions in their own
projects.
--
You received this message because you are subscribed to the Google Groups "Aleph" group.
To unsubscribe from this group and stop receiving emails from it, send an email to aleph-lib+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
ztellman
2015-04-18 00:46:27 UTC
Permalink
I'm not opposed to this. What pieces of middleware do you have in mind to
reimplement?
Post by David Smith
Is there some way we could have a collection of aleph server middleware
that alters the response, i.e. where ring middleware does not work? There
could be a new project aleph-middleware or something, I'm sure there are
plenty of people who have written the required functions in their own
projects.
--
You received this message because you are subscribed to the Google Groups "Aleph" group.
To unsubscribe from this group and stop receiving emails from it, send an email to aleph-lib+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
David Smith
2015-04-22 10:05:53 UTC
Permalink
Basically anything that operates on the server response such as
`wrap-json-body`, `wrap-cookies` etc
Post by ztellman
I'm not opposed to this. What pieces of middleware do you have in mind to
reimplement?
Post by David Smith
Is there some way we could have a collection of aleph server middleware
that alters the response, i.e. where ring middleware does not work? There
could be a new project aleph-middleware or something, I'm sure there are
plenty of people who have written the required functions in their own
projects.
--
You received this message because you are subscribed to the Google Groups "Aleph" group.
To unsubscribe from this group and stop receiving emails from it, send an email to aleph-lib+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Atamert Ölçgen
2015-10-02 14:59:33 UTC
Permalink
I have created aleph versions of middleware that's bundled with ring:

https://github.com/muhuk/aleph-middleware

(Only the one's modifying the response.)

I wish there was a better way to do this than manually patching them one by
one.

Now I want to use ring-transit and even though I don't have to return a
deferred from my handler it feels wrong to depend on the handlers
implementation like this.

Have anyone else found a better way to deal with the middleware?

I suppose sticking a middleware that derefs deferreds just before
non-aleph-aware middleware is one way to do this in a generic way. But then
you'd lose asynchronicity, no?
Post by David Smith
Basically anything that operates on the server response such as
`wrap-json-body`, `wrap-cookies` etc
Post by ztellman
I'm not opposed to this. What pieces of middleware do you have in mind
to reimplement?
Post by David Smith
Is there some way we could have a collection of aleph server middleware
that alters the response, i.e. where ring middleware does not work? There
could be a new project aleph-middleware or something, I'm sure there are
plenty of people who have written the required functions in their own
projects.
--
You received this message because you are subscribed to the Google Groups "Aleph" group.
To unsubscribe from this group and stop receiving emails from it, send an email to aleph-lib+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Robert Zabel
2015-10-07 17:23:00 UTC
Permalink
Hey Atamert Ölçgen,
i checked out your repo. I'm kind of new here, so bear with me.
In your middleware you'r derefing the return value of the handler.

1. Wouldn't it be better to check if a deferred or something else is
returned?
What happens if you put two of your middlewares in a handler.
The first one derefs the deferred, does some modification and passes the
result to
the second wich tries to deref what is given to it and fails, since it got
a map.....

2. You're derefing in the middleware to customize it, don't you loose the
advantages
of handling reqests asynchronously - where you deref it will block.
You could as well deref the deferred right where it is returned and be
better of, because you don't
have to touch any middleware at all.

What do you think about checking if the handlers returns a deferred an then
chaining the modification to it?
Post by Atamert Ölçgen
https://github.com/muhuk/aleph-middleware
(Only the one's modifying the response.)
I wish there was a better way to do this than manually patching them one
by one.
Now I want to use ring-transit and even though I don't have to return a
deferred from my handler it feels wrong to depend on the handlers
implementation like this.
Have anyone else found a better way to deal with the middleware?
I suppose sticking a middleware that derefs deferreds just before
non-aleph-aware middleware is one way to do this in a generic way. But then
you'd lose asynchronicity, no?
Post by David Smith
Basically anything that operates on the server response such as
`wrap-json-body`, `wrap-cookies` etc
Post by ztellman
I'm not opposed to this. What pieces of middleware do you have in mind
to reimplement?
Post by David Smith
Is there some way we could have a collection of aleph server middleware
that alters the response, i.e. where ring middleware does not work? There
could be a new project aleph-middleware or something, I'm sure there are
plenty of people who have written the required functions in their own
projects.
--
You received this message because you are subscribed to the Google Groups "Aleph" group.
To unsubscribe from this group and stop receiving emails from it, send an email to aleph-lib+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Loading...