Update getting_started.md
Hello World example at the main Readme file (https://github.com/channelcat/sanic/blob/master/README.rst) is different, it returns json. Here is returned text. In the following examples, such as Routing (http://sanic.readthedocs.io/en/latest/sanic/routing.html) is again used json. Therefore I suggest to make examples the same, having json as output
This commit is contained in:
parent
9fb8bec715
commit
c836441a75
|
@ -9,15 +9,16 @@ syntax, so earlier versions of python won't work.
|
||||||
|
|
||||||
```python
|
```python
|
||||||
from sanic import Sanic
|
from sanic import Sanic
|
||||||
from sanic.response import text
|
from sanic.response import json
|
||||||
|
|
||||||
app = Sanic(__name__)
|
app = Sanic()
|
||||||
|
|
||||||
@app.route("/")
|
@app.route("/")
|
||||||
async def test(request):
|
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`
|
3. Run the server: `python3 main.py`
|
||||||
|
|
Loading…
Reference in New Issue
Block a user