Hatman commited on
Commit
a8b0080
·
verified ·
1 Parent(s): 876ad45

Update main.py

Browse files
Files changed (1) hide show
  1. main.py +10 -0
main.py CHANGED
@@ -1,8 +1,18 @@
1
  from fastapi import FastAPI
2
  from fastapi.responses import HTMLResponse
 
3
 
4
  app = FastAPI()
5
 
 
 
 
 
 
 
 
 
 
6
  @app.get("/", response_class=HTMLResponse)
7
  async def read_root():
8
  html_content = """
 
1
  from fastapi import FastAPI
2
  from fastapi.responses import HTMLResponse
3
+ from fastapi.middleware.cors import CORSMiddleware
4
 
5
  app = FastAPI()
6
 
7
+ # Add CORS middleware
8
+ app.add_middleware(
9
+ CORSMiddleware,
10
+ allow_origins=["*"],
11
+ allow_credentials=True,
12
+ allow_methods=["*"],
13
+ allow_headers=["*"],
14
+ )
15
+
16
  @app.get("/", response_class=HTMLResponse)
17
  async def read_root():
18
  html_content = """