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
dbobject is shared via NodeJS'AsyncLocalStoragefeature:Demo
VALUE_FROM_EXPRESSis shared via@react-router/expressgetLoadContextfeatureI tried this:
app.use( createRequestHandler({ ... getLoadContext() { return { + db, VALUE_FROM_EXPRESS: "Hello from Express", } }, }), )and it works,
dbis accesible in loader. So why do we need more verboseAsyncLocalStorageafter all?Beta Was this translation helpful? Give feedback.
All reactions