-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.py
More file actions
30 lines (19 loc) · 629 Bytes
/
Copy pathmain.py
File metadata and controls
30 lines (19 loc) · 629 Bytes
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
import uvicorn
from fastapi import FastAPI
from fastapi.responses import RedirectResponse
from database.connection import Settings
from routes.events import event_router
from routes.users import user_router
app = FastAPI()
settings = Settings()
# Register routes
app.include_router(user_router, prefix="/user")
app.include_router(event_router, prefix="/event")
@app.on_event("startup")
async def init_db():
await settings.initialize_database()
@app.get("/")
async def home():
return RedirectResponse(url="/event/")
if __name__ == '__main__':
uvicorn.run("main:app", host="0.0.0.0", port=8080, reload=True)