Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Question on middleware implementation #135

Open
NixBiks opened this issue Oct 6, 2020 · 3 comments
Open

Question on middleware implementation #135

NixBiks opened this issue Oct 6, 2020 · 3 comments

Comments

@NixBiks
Copy link

NixBiks commented Oct 6, 2020

Hi @Buuntu

I really like your boilerplate here - there's a lot of good practices to study I think. I stumbled upon one thing that puzzles me a bit though. You add middleware to create a database session for each request and close it again. But you also create a dependency to do the same if I'm not mistaken?

I imagine that you first implemented the middleware approach but realized you could solve it with dependency injection instead? I'm curious if I'm wrong in my perception?

@NixBiks
Copy link
Author

NixBiks commented Oct 6, 2020

Another thing that puzzles me is get_test_db_url() in conftest.py. To me it looks like it points to a dbname that doesn't exist? But maybe that's not a problem with postgres?

@Buuntu
Copy link
Owner

Buuntu commented Oct 8, 2020

Another thing that puzzles me is get_test_db_url() in conftest.py. To me it looks like it points to a dbname that doesn't exist? But maybe that's not a problem with postgres?

This is because it's a test fixture, you don't want it to point to a real database.

@pmsoltani
Copy link

Hi @Buuntu

I really like your boilerplate here - there's a lot of good practices to study I think. I stumbled upon one thing that puzzles me a bit though. You add middleware to create a database session for each request and close it again. But you also create a dependency to do the same if I'm not mistaken?

I imagine that you first implemented the middleware approach but realized you could solve it with dependency injection instead? I'm curious if I'm wrong in my perception?

I have the same question 😉
BTW, thanks for the repo, @Buuntu

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants