| 1 |
.. _quickstart: |
| 2 |
|
| 3 |
Quickstart |
| 4 |
========== |
| 5 |
|
| 6 |
Hello World |
| 7 |
----------- |
| 8 |
|
| 9 |
A very simple app that simply returns a response containing ``hello`` |
| 10 |
is, (file ``hello-world.py``) |
| 11 |
|
| 12 |
.. code-block:: python |
| 13 |
|
| 14 |
from quart import Quart |
| 15 |
|
| 16 |
app = Quart(__name__) |
| 17 |
|
| 18 |
@app.route('/') |
| 19 |
async def hello(): |
| 20 |
return 'hello' |
| 21 |
|
| 22 |
app.run() |
| 23 |
|
| 24 |
and is simply run via |
| 25 |
|
| 26 |
.. code-block:: console |
| 27 |
|
| 28 |
python hello-world.py |
| 29 |
|
| 30 |
or alternatively |
| 31 |
|
| 32 |
.. code-block:: console |
| 33 |
|
| 34 |
$ export QUART_APP=hello-world:app |
| 35 |
$ quart run |
| 36 |
|
| 37 |
and tested by |
| 38 |
|
| 39 |
.. code-block:: sh |
| 40 |
|
| 41 |
curl localhost:5000 |
| 42 |
|
| 43 |
See also |
| 44 |
-------- |
| 45 |
|
| 46 |
:ref:`cheatsheet` |