node-postgres template: two competing ways to share context #13711
Unanswered
ivan-kleshnin
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
I'm exploring this template: https://github.com/remix-run/react-router-templates/tree/main/node-postgres
db
object is shared via NodeJS'AsyncLocalStorage
feature:Demo
VALUE_FROM_EXPRESS
is shared via@react-router/express
getLoadContext
featureI tried this:
app.use( createRequestHandler({ ... getLoadContext() { return { + db, VALUE_FROM_EXPRESS: "Hello from Express", } }, }), )
and it works,
db
is accesible in loader. So why do we need more verboseAsyncLocalStorage
after all?Beta Was this translation helpful? Give feedback.
All reactions