Debian Codegraph @

docs_src/custom_response/tutorial003_py310.py

raw
1 from fastapi import FastAPI
2 from fastapi.responses import HTMLResponse
3
4 app = FastAPI()
5
6
7 @app.get("/items/")
8 async def read_items():
9 html_content = """
10 <html>
11 <head>
12 <title>Some HTML in here</title>
13 </head>
14 <body>
15 <h1>Look ma! HTML!</h1>
16 </body>
17 </html>
18 """
19 return HTMLResponse(content=html_content, status_code=200)