create core framework

This commit is contained in:
2024-11-02 23:04:36 +08:00
parent 6acf6d1d6e
commit 544229b7a6
30 changed files with 1612 additions and 16 deletions

20
core/example/hello.py Normal file
View File

@@ -0,0 +1,20 @@
from bugis.core import BugisApp, HttpContext
class Hello(BugisApp):
async def handle_request(self, ctx: HttpContext) -> None:
async for chunk in ctx.request_body:
print(chunk)
await ctx.send_str(200, 'Hello World')
app = BugisApp()
@app.GET('/hello')
@app.GET('/hello2')
async def handle_request(ctx: HttpContext) -> None:
async for chunk in ctx.request_body:
print(chunk)
await ctx.send_str(200, 'Hello World')