Skip to content

Commit

Permalink
repush
Browse files Browse the repository at this point in the history
  • Loading branch information
ChihweiLHBird committed Mar 20, 2023
1 parent 158cf16 commit 76fce02
Show file tree
Hide file tree
Showing 3 changed files with 44 additions and 0 deletions.
11 changes: 11 additions & 0 deletions 1.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import sanic

# hello world example
app = sanic.Sanic("MySanic")

@app.route("/")
async def test(request):
return sanic.response.text("Hello, world.")

if __name__ == "__main__":
app.run()
9 changes: 9 additions & 0 deletions c.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import httpx, asyncio
from httpx import AsyncClient, Headers

client = AsyncClient()

async def main():
res = await client.get("http://localhost:8000/")
print(res.text)
asyncio.run(main())
24 changes: 24 additions & 0 deletions test-bpc.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
from sanic import Blueprint
from sanic.response import text
from sanic import Sanic

app = Sanic('test')

bpv1 = Blueprint('bpv1', version=1)

@bpv1.route('/hello')
async def root(request):
return text('hello v1')

app.blueprint(bpv1)

bpv2 = bpv1.copy('bpv2', version=2, allow_route_overwrite=True)

@bpv2.route('/hello')
async def root(request):
return text('hello v2')

app.blueprint(bpv2)

if __name__ == '__main__':
app.run()

0 comments on commit 76fce02

Please sign in to comment.