Skip to content

Add Panther framework usage example #152

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

Merged
merged 1 commit into from
Jul 12, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions docs/.vuepress/sidebar.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ export default sidebar({
"litestar",
"blacksheep",
"robyn",
"panther",
]
},
],
Expand Down
48 changes: 48 additions & 0 deletions docs/usage/frameworks/panther.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
---
title: Panther
---

There is the default example for `Panther` framework.

We strongly recommend to use the following example as a standard way to use `PSQLPy` with `Panther` framework.

## Complete example

```python
import uvicorn
from psqlpy import ConnectionPool

from panther import Panther
from panther.app import API
from panther.configs import config
from panther.events import Event
from panther.response import Response


@Event.startup
async def create_connection_pool():
config.connection_pool = ConnectionPool(
dsn="postgres://postgres:postgres@localhost:5432/postgres",
max_db_pool_size=10,
)


@Event.shutdown
async def close_connection_pool():
config.connection_pool.close()


@API()
async def pg_pool_example():
connection = await config.connection_pool.connection()
query_result = await connection.execute(
"SELECT * FROM users",
)
return Response(data=query_result.result())


app = Panther(__name__, configs=__name__, urls={'/': pg_pool_example})

if __name__ == "__main__":
uvicorn.run(app)
```
Loading
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy