Spaces:
Sleeping
Sleeping
Update main.py
Browse files
main.py
CHANGED
@@ -2,6 +2,18 @@ from fastapi import FastAPI
|
|
2 |
|
3 |
app = FastAPI()
|
4 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
5 |
@app.get("/api/python")
|
6 |
def hello_world():
|
7 |
return {"message": "Hello World"}
|
|
|
2 |
|
3 |
app = FastAPI()
|
4 |
|
5 |
+
origins = ['http://localhost:3000', 'http://127.0.0.1:3000',
|
6 |
+
'https://localhost:3000', 'https://127.0.0.1:3000']
|
7 |
+
|
8 |
+
app.add_middleware(
|
9 |
+
CORSMiddleware,
|
10 |
+
allow_origins=['*']
|
11 |
+
)
|
12 |
+
|
13 |
+
@app.get("/")
|
14 |
+
def read_root():
|
15 |
+
return {"message": "Hello World"}
|
16 |
+
|
17 |
@app.get("/api/python")
|
18 |
def hello_world():
|
19 |
return {"message": "Hello World"}
|