-
Notifications
You must be signed in to change notification settings - Fork 15
How to expose express req/res objects to node-wpapi #77
Comments
This isn't possible currently, but wouldn't take much to implement, at least for SSR anyway. Creating a dummy request object on the client would be bit more work, if desirable. For the former only (access to |
Thanks @sdgluck, I probably don't have the bandwidth to take this on any time soon, but will definitely circle back if time opens up for me. Thanks for the quick response, excited to see the continued development of this great project. |
@MickeyKay Can I confirm that when you say "pass |
Possibly. More specifically, the idea would be to instantiate our backing node-wpapi object with a custom transport method hooked into a node-redis instance. That way, we have a secondary cache that can short-circuit external requests across sessions, as opposed to Kasia's single-session "caching" logic (in which objects already in the store are not re-requested). |
In that case I'm not sure I understand what functionality you are asking to see in Kasia. Could you give an example of the kind of API you're looking for? |
Yeah, I'm thinking this is probably less a Kasia-specific question and more a general wp-api question. This is newer territory for me, so thanks for your patience :) |
Is there a way to pass our express app's
req
/res
objects to Kasia, specifically within our node-wpapi instance?We've trying to hook up node-redis middleware for server-side caching, and the cache instance gets passed through on the
req
object. I'm thinking we can create a customtransport
method ala https://github.com/WP-API/node-wpapi#customizing-http-request-behavior and then check for the existence of the cache instance to bypass doing an actual fetch, however to do this we need to be able to check thereq
object. Any ideas? Thanks!The text was updated successfully, but these errors were encountered: