Debian Codegraph @

docs_src/custom_response/tutorial002_py310.py

raw
1 from fastapi import FastAPI
2 from fastapi.responses import HTMLResponse
3
4 app = FastAPI()
5
6
7 @app.get("/items/", response_class=HTMLResponse)
8 async def read_items():
9 return """
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 """