File tree Expand file tree Collapse file tree 1 file changed +4
-5
lines changed
Expand file tree Collapse file tree 1 file changed +4
-5
lines changed Original file line number Diff line number Diff line change 1414def index (request ):
1515 return web .Response (body = b'<h1>Index</h1>' )
1616
17- def hello (request ):
18- yield from asyncio .sleep (0.5 )
17+ async def hello (request ):
18+ await asyncio .sleep (0.5 )
1919 text = '<h1>hello, %s!</h1>' % request .match_info ['name' ]
2020 return web .Response (body = text .encode ('utf-8' ))
2121
22- @asyncio .coroutine
23- def init (loop ):
22+ async def init (loop ):
2423 app = web .Application (loop = loop )
2524 app .router .add_route ('GET' , '/' , index )
2625 app .router .add_route ('GET' , '/hello/{name}' , hello )
27- srv = yield from loop .create_server (app .make_handler (), '127.0.0.1' , 8000 )
26+ srv = await loop .create_server (app .make_handler (), '127.0.0.1' , 8000 )
2827 print ('Server started at http://127.0.0.1:8000...' )
2928 return srv
3029
You can’t perform that action at this time.
0 commit comments