Skip to content

How to use Postgres Pool and attach it to context.state? #305

Answered by kitsonk
halvardssm asked this question in Q&A
Discussion options

You must be logged in to vote

The ctx.state is a clone of ctx.app.state that is created for each request/response interaction.

Because .pool is intended to be "global" and exist for the lifetime of the application, I would try to use ctx.app.state.pool and see if that resolves the issue.

Replies: 1 comment 6 replies

Comment options

You must be logged in to vote
6 replies
@kitsonk
Comment options

@halvardssm
Comment options

@harvister
Comment options

@halvardssm
Comment options

@harvister
Comment options

Answer selected by halvardssm
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants