-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathmain.py
36 lines (28 loc) · 826 Bytes
/
main.py
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
36
import uvicorn
from dotenv import load_dotenv
from app.api.endpoints import stations, paths, lines
from fastapi.middleware.cors import CORSMiddleware
from app.services.neo4j.graph import db
from fastapi import FastAPI
import os
def create_app():
_app = FastAPI()
_app.add_middleware(
CORSMiddleware,
allow_origins=["*"],
allow_credentials=True,
allow_methods=["*"],
allow_headers=["*"],
)
_app.include_router(paths.router)
_app.include_router(stations.router)
_app.include_router(lines.router)
return _app
# Create app
load_dotenv()
db.driver.verify_connectivity()
app = create_app()
if __name__ == '__main__':
PORT = os.getenv("PORT")
if not PORT:PORT = "8200"
uvicorn.run("main:app", reload=True,host="0.0.0.0",port=int(PORT))