Skip to content

Commit

Permalink
fix: add CORS (#21)
Browse files Browse the repository at this point in the history
  • Loading branch information
fubuloubu authored Oct 26, 2023
1 parent a84dcd3 commit 8bd9f0a
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions main.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
from fastapi import FastAPI, File, UploadFile, HTTPException, BackgroundTasks, Query
from fastapi.middleware.cors import CORSMiddleware
import os
from pydantic import BaseModel
from enum import Enum
Expand All @@ -16,6 +17,22 @@

PackageManifest.update_forward_refs()
app = FastAPI()
app.add_middleware(
CORSMiddleware,
allow_origins=[
# NOTE: When running remix in local dev, this is the URL
"http://localhost:8080",
# NOTE: When running `npm run build && npm run preview`, this is the URL
"http://localhost:4173",
# NOTE: This is where the UI gets hosted
"https://remix.ethereum.org",
"https://remix-alpha.ethereum.org",
"https://remix-beta.ethereum.org",
],
allow_credentials=True,
allow_methods=["*"],
allow_headers=["*"],
)


class TaskStatus(Enum):
Expand Down

0 comments on commit 8bd9f0a

Please sign in to comment.