#How to pass an object from express to astro ssrHandler middleware?

5 messages · Page 1 of 1 (latest)

wide galleon
#

i am using astro with node adaptor as middleware, my express server is doing a custom processing before every request and generates an object , i want to add/provide this object for astro pages/routes to use , how/where i can set this object so its available in astro pages ?

daring wyvernBOT
#
No-one around right now?

It looks like no-one has responded to your question yet. People might not be available right now or don’t know how to answer your question. Want an answer while you wait? Try asking our experimental bot in #1095492539085230272.

knotty sapphire
#

I don't think there's currently a way to directly pass data to the astro middeware, maybe you can create an API that the Astro middleware can consume?

earnest kindle
#

What I did is pass data in environment variables, it works for node adapter, as it is the same process, (but not in serverless) So create in express, read in Astro. But it has to be a map of user sessions not to leak data between users, and it has to be serialized. The alternative would be to use a database, in memory or some new fancy key value store depending on your deployment. Now even deno offer it.

wide galleon