Skip to content

Commit

Permalink
Allow connections from localhost, regardless of CORS
Browse files Browse the repository at this point in the history
  • Loading branch information
kerinin committed Jan 25, 2024
1 parent cd8deb9 commit fe94877
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions dewy/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import asyncpg
from fastapi import FastAPI
from loguru import logger
from fastapi.middleware.cors import CORSMiddleware

from dewy.common import db
from dewy.config import app_configs, settings
Expand Down Expand Up @@ -42,6 +43,16 @@ async def lifespan(_app: FastAPI) -> AsyncIterator[State]:

app = FastAPI(lifespan=lifespan, **app_configs)

origins = [
"http://localhost:5173",
]
app.add_middleware(
CORSMiddleware,
allow_origins=origins,
allow_credentials=True,
allow_methods=["*"],
allow_headers=["*"],
)

@app.get("/healthcheck", include_in_schema=False)
async def healthcheck() -> dict[str, str]:
Expand Down

0 comments on commit fe94877

Please sign in to comment.