freeleaps-service-hub/apps/devops/routes/hello_world/apis.py

23 lines
493 B
Python

from fastapi import APIRouter
from loguru import logger
from common.daos.hello_world import hello_world_dao
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):
"""
Insert a HelloWorld document into the database.
"""
hello_world = await hello_world_dao.create_hello_world(msg, 1)
return hello_world