from aiohttp import web import json routes = web.RouteTableDef() data = [2,3,4] @routes.get("/show") async def show_me(req : web.Request) -> web.Response: return web.Response(status=200, text=json.dumps(data)) @routes.put("/add") async def add_me(req : web.Request) -> web.Response: new_thing = await req.json() data.append(new_thing) return await show_me(req) if __name__ == '__main__': app = web.Application() app.add_routes(routes) web.run_app(app) # this function never returns