sanic/tests/python.aiohttp.py

14 lines
284 B
Python
Raw Normal View History

2016-10-03 02:45:44 +01:00
from aiohttp import web
async def handle(request):
name = request.match_info.get('name', "Anonymous")
text = "Hello, " + name
return web.Response(text=text)
app = web.Application()
app.router.add_get('/', handle)
app.router.add_get('/{name}', handle)
web.run_app(app)