Skip to content

Commit

Permalink
Fixed to merge with sanic-org#626
Browse files Browse the repository at this point in the history
  • Loading branch information
Sniedes722 committed Apr 11, 2017
1 parent a0730ae commit 3c45c91
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions examples/sanic_motor.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
sanic==0.2.0
"""
from sanic import Sanic
from sanic.response import json
from sanic import response


app = Sanic('motor_mongodb')
Expand All @@ -25,7 +25,7 @@ async def get(request):
for doc in docs:
doc['id'] = str(doc['_id'])
del doc['_id']
return json(docs)
return response.json(docs)


@app.route('/post', methods=['POST'])
Expand All @@ -34,8 +34,8 @@ async def new(request):
print(doc)
db = get_db()
object_id = await db.test_col.save(doc)
return json({'object_id': str(object_id)})
return response.json({'object_id': str(object_id)})


if __name__ == "__main__":
app.run(host='127.0.0.1', port=8000)
app.run(host='0.0.0.0', port=8000, debug=True)

0 comments on commit 3c45c91

Please sign in to comment.