Allow CORS requests
This commit is contained in:
parent
4a2fa001c2
commit
916c55a2e4
1 changed files with 12 additions and 2 deletions
14
main.py
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
|
||||
|
|
Reference in a new issue