Allow CORS requests

This commit is contained in:
Gabriel Augendre 2021-11-12 15:58:03 +01:00
parent 4a2fa001c2
commit 916c55a2e4

14
main.py
View file

@ -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