Skip to content

Commit

Permalink
add compression middleware
Browse files Browse the repository at this point in the history
  • Loading branch information
vincentsarago committed Aug 29, 2024
1 parent 789b2b1 commit 9ffe68c
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 0 deletions.
1 change: 1 addition & 0 deletions space2stats_api/src/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ dependencies = [
"geojson-pydantic",
"pydantic-settings>=2.0.0",
"typing_extensions",
"starlette-cramjam>=0.3,<0.4",
]

[project.optional-dependencies]
Expand Down
2 changes: 2 additions & 0 deletions space2stats_api/src/space2stats/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
from typing import Any, Dict, List

from starlette.requests import Request
from starlette_cramjam.middleware import CompressionMiddleware

from .db import connect_to_db, close_db_connection
from .main import get_summaries_from_geom, get_available_fields, SummaryRequest
Expand All @@ -29,6 +30,7 @@ async def lifespan(app: FastAPI):
allow_methods=["*"],
allow_headers=["*"],
)
app.add_middleware(CompressionMiddleware)


@app.post("/summary", response_model=List[Dict[str, Any]])
Expand Down

0 comments on commit 9ffe68c

Please sign in to comment.