11 lines
336 B
Python
11 lines
336 B
Python
from fastapi import APIRouter, status
|
|
from typing import Dict
|
|
import random
|
|
|
|
router = APIRouter()
|
|
|
|
@router.get("/endpoint", status_code=status.HTTP_200_OK, response_model=Dict[str, str])
|
|
async def get_random_color():
|
|
"""Generate a random color"""
|
|
color = '#{:06x}'.format(random.randint(0, 0xFFFFFF))
|
|
return {"color": color} |