-
Notifications
You must be signed in to change notification settings - Fork 95
/
app.py
24 lines (15 loc) · 646 Bytes
/
app.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
from fastapi import FastAPI, Depends
from auth.jwt_bearer import JWTBearer
from config.config import initiate_database
from routes.admin import router as AdminRouter
from routes.student import router as StudentRouter
app = FastAPI()
token_listener = JWTBearer()
@app.on_event("startup")
async def start_database():
await initiate_database()
@app.get("/", tags=["Root"])
async def read_root():
return {"message": "Welcome to this fantastic app."}
app.include_router(AdminRouter, tags=["Administrator"], prefix="/admin")
app.include_router(StudentRouter,tags=["Students"],prefix="/student",dependencies=[Depends(token_listener)],)