Skip to content

Instantly share code, notes, and snippets.

@VietThan
Created March 15, 2024 14:04
Show Gist options
  • Save VietThan/717596ebc47af3b8ff95131dd0d502e1 to your computer and use it in GitHub Desktop.
Save VietThan/717596ebc47af3b8ff95131dd0d502e1 to your computer and use it in GitHub Desktop.
Litestar get favicon.ico
import pathlib
from litestar import Litestar, get
from litestar.response import File
@get(path='/favicon.ico')
async def handle_favicon_get() -> File:
icon_path = pathlib.Path(__file__).parent / 'crylaugh2.ico'
return File(
path=icon_path,
filename="favicon.ico"
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment