File size: 785 Bytes
7e85237
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
import os
from fastapi import FastAPI
from fastapi.middleware.cors import CORSMiddleware

debug = bool(os.getenv("DEBUG", False))

app = FastAPI(
    title='Huge IFX',
    version='1.0',
    description='Huge IFX with FastAPI',
)

# Set all CORS enabled origins
app.add_middleware(
    CORSMiddleware,
    allow_origins=["*"],
    allow_credentials=True,
    allow_methods=["*"],
    allow_headers=["*"],
    expose_headers=["*"],
)

# Your existing endpoints
@app.get('/')
async def home():
    return {'message': 'Home'}

if debug:
    import debugpy
    debugpy.listen(("0.0.0.0", 5678))
    print("VS Code debugger is ready to be attached, press F5 in VS Code...")

if __name__ == '__main__':
    import uvicorn
    uvicorn.run('server:app', host='0.0.0.0', port=8000, reload=True)