📝 Add docs for custom response

This commit is contained in:
Sebastián Ramírez
2018-12-15 15:20:22 +04:00
parent 0df2720490
commit f6667ecfb0
7 changed files with 185 additions and 0 deletions

View File

@@ -0,0 +1,19 @@
from fastapi import FastAPI
from starlette.responses import HTMLResponse
app = FastAPI()
@app.get("/items/")
async def read_items():
html_content = """
<html>
<head>
<title>Some HTML in here</title>
</head>
<body>
<h1>Look ma! HTML!</h1>
</body>
</html>
"""
return HTMLResponse(content=html_content, status_code=200)