from fastapi import APIRouter, Depends from loguru import logger from app.common.daos.hello_world import get_hello_world_dao, HelloWorldDao router = APIRouter() @router.get("/") async def hello_world(): logger.info("Hello, World! endpoint was called") return {"message": "Hello, World!"} @router.post("/insert") async def insert_hello_world(msg: str, dao: HelloWorldDao = Depends(get_hello_world_dao)): """ Insert a HelloWorld document into the database. """ hello_world = await dao.create_hello_world(msg, 1) return hello_world