Allow CORS requests

master
Gabriel Augendre 11 months ago
parent 4a2fa001c2
commit 916c55a2e4
  1. 14
      main.py

@ -1,14 +1,24 @@
import enum
import re
from typing import Any, DefaultDict, List, Optional
from typing import DefaultDict, List, Optional
import httpx
from fastapi import FastAPI, HTTPException
from fastapi.middleware.cors import CORSMiddleware
from fastapi.params import Header, Path
from pydantic import BaseModel
app = FastAPI()
origins = ["http://localhost:3000", "https://display.augendre.info"]
app.add_middleware(
CORSMiddleware,
allow_origins=origins,
allow_credentials=True,
allow_methods=["*"],
allow_headers=["*"],
)
class Passage(BaseModel):
ligne: str

Loading…
Cancel
Save