-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.py
41 lines (29 loc) · 828 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
37
38
39
40
41
import uvicorn
from fastapi import APIRouter, FastAPI
from common.log import logger
from authentication.routes import auth_router
from features.product.routes import product_router
# Init FastAPI app
app = FastAPI(
title='Ecommerce API',
version='0.1.0',
swagger_ui_parameters={'syntaxHighlight.theme': 'obsidian'},
)
# Routers
api_router = APIRouter(prefix='/api')
api_router.include_router(auth_router, tags=['auth'])
api_router.include_router(product_router, tags=['product'])
app.include_router(api_router)
# Startup event
# @app.on_event('startup')
# async def startup():
# ...
# Shutdown event
async def shutdown():
...
@app.get('/')
async def root():
logger.info(msg='GET Request to /')
return {'message': f'Head to /docs to view api documentation'}
if __name__ == "__main__":
uvicorn.run(app)