Merge pull request #946 from trthhrtz/patch-1

Update getting_started.md
This commit is contained in:
Eli Uriegas 2017-09-18 11:13:48 -07:00 committed by GitHub
commit 329ebf6a5d

View File

@ -9,15 +9,16 @@ syntax, so earlier versions of python won't work.
```python
from sanic import Sanic
from sanic.response import text
from sanic.response import json
app = Sanic(__name__)
app = Sanic()
@app.route("/")
async def test(request):
return text('Hello world!')
return json({"hello": "world"})
app.run(host="0.0.0.0", port=8000, debug=True)
if __name__ == "__main__":
app.run(host="0.0.0.0", port=8000)
```
3. Run the server: `python3 main.py`