This commit is contained in:
2025-04-09 16:54:34 +08:00
parent 7cf1c7741d
commit 1d9ab14b01
11 changed files with 650 additions and 0 deletions

27
test.py Normal file
View File

@@ -0,0 +1,27 @@
from app import App
from app.components.http import HTTPComponent
# from app.components.lifespan import LifespanComponent
from app.subroutines.http import HTMLResponse
app = App()
# lifespan = app.use_component(LifespanComponent())
http = app.use_component(HTTPComponent())
@http.route("/teapot", get=True, post=True, put=True, delete=True)
async def teapot() -> HTMLResponse:
resp = """
<!DOCTYPE html>
<html>
<head>
<title>I'm a Teapot!!!</title>
</head>
<body>
<h1>I'm a Teapot!!!</h1>
<p>I've already told you I'm a teapot.</p>
</body>
</html>
"""
return HTMLResponse(status=418, content=resp)