aiohttp 类 tornado 代码风格模式去开发 !!!完美阿!!!!
Posted 74 months ago aiohttp tornado linux asyncio callback
仔细读了一下 aiohttp 的文档
http://aiohttp.readthedocs.io/en/stable/index.html
= = 竟然!!!
竟然有了!!!!!
类tornado开发特色的!!! 贼开心
from aiohttp import web
class basic(web.View):
def out(self,text):
return web.Response(text=text)
class Index(basic):
async def get(self):
name = self.request.match_info.get('name', "Anonymous")
text = "Hello, " + name
return self.out(text=text)
app = web.Application()
app.add_routes([web.view('/', Index),])
if __name__ == "__main__":
web.run_app(app)