Skip to content

Commit

Permalink
switch to orjson
Browse files Browse the repository at this point in the history
  • Loading branch information
vincentsarago committed Aug 29, 2024
1 parent 9ffe68c commit 66b3054
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
1 change: 1 addition & 0 deletions space2stats_api/src/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ authors = [
]
dynamic = ["version"]
dependencies = [
"orjson",
"fastapi>=0.112.0",
"pandas",
"shapely",
Expand Down
6 changes: 5 additions & 1 deletion space2stats_api/src/space2stats/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

from fastapi import FastAPI
from fastapi.middleware.cors import CORSMiddleware
from fastapi.responses import ORJSONResponse

from typing import Any, Dict, List

Expand All @@ -21,7 +22,10 @@ async def lifespan(app: FastAPI):
await close_db_connection(app)


app = FastAPI(lifespan=lifespan)
app = FastAPI(
default_response_class=ORJSONResponse,
lifespan=lifespan,
)

app.add_middleware(
CORSMiddleware,
Expand Down

0 comments on commit 66b3054

Please sign in to comment.