Improve examples/custom_protocol.py

This commit is contained in:
38elements 2016-12-26 23:54:59 +09:00
parent ac44900fc4
commit 39b279f0f2

View File

@ -16,9 +16,13 @@ class CustomHttpProtocol(HttpProtocol):
self.transport.close() self.transport.close()
@app.route("/") @app.route('/')
async def test(request): async def string(request):
return 'Hello, world!' return 'string'
app.run(host="0.0.0.0", port=8000, protocol=CustomHttpProtocol) @app.route('/1')
async def response(request):
return text('response')
app.run(host='0.0.0.0', port=8000, protocol=CustomHttpProtocol)