From 46ac79f4dcd62fcbcb39a689e48f9f3ef947d6d9 Mon Sep 17 00:00:00 2001 From: Shawn Niederriter Date: Thu, 6 Apr 2017 14:39:54 -0400 Subject: [PATCH] Update run_async demo --- examples/run_async.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/examples/run_async.py b/examples/run_async.py index d514c7d0..1fb232c3 100644 --- a/examples/run_async.py +++ b/examples/run_async.py @@ -1,5 +1,5 @@ from sanic import Sanic -from sanic.response import json +from sanic import response from multiprocessing import Event from signal import signal, SIGINT import asyncio @@ -9,10 +9,10 @@ app = Sanic(__name__) @app.route("/") async def test(request): - return json({"answer": "42"}) + return response.json({"answer": "42"}) asyncio.set_event_loop(uvloop.new_event_loop()) -server = app.create_server(host="0.0.0.0", port=8001) +server = app.create_server(host="0.0.0.0", port=8080) loop = asyncio.get_event_loop() task = asyncio.ensure_future(server) signal(SIGINT, lambda s, f: loop.stop())