Skip to content

Commit

Permalink
Migrates from sanic webserver to fastapi
Browse files Browse the repository at this point in the history
  • Loading branch information
HazardDede committed Nov 22, 2020
1 parent 7661206 commit 1e1e830
Show file tree
Hide file tree
Showing 28 changed files with 721 additions and 522 deletions.
2 changes: 0 additions & 2 deletions docs/source/code-samples/advanced/api/example.yaml
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
api:
port: 9999 # API listens on port 9999; mandatory
endpoints: # Optional
# Enable swagger endpoint: http://localhost:9999/swagger, default is false.
swagger: true
# Enable metrics endpoint: http://localhost:9999/metrics, default is false.
metrics: true
tasks:
Expand Down
1 change: 0 additions & 1 deletion docs/source/code-samples/advanced/api/trigger.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
api:
port: 9999
endpoints:
swagger: true
metrics: false
tasks:
- name: my_task
Expand Down
2 changes: 0 additions & 2 deletions docs/source/code-samples/examples/speedtest_mqtt.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@
# curl -X POST "http://localhost:80/trigger?task=speedtest" -H "accept: application/json"
api:
port: 80
endpoints:
swagger: true
tasks:
- name: speedtest
pull:
Expand Down
6 changes: 3 additions & 3 deletions docs/source/usage/advanced.rst
Original file line number Diff line number Diff line change
Expand Up @@ -59,16 +59,16 @@ Retrieve prometheus compliant metrics::

curl -X GET "http://localhost:9999/metrics"

See the swagger specification in your browser:
`http://localhost:9999/swagger <http://localhost:9999/swagger>`_
See the openapi specification in your browser:
`http://localhost:9999/docs <http://localhost:9999/docs>`_

Trigger tasks manually (even when the task has some schedule assigned)::

curl -X POST "http://localhost:9999/trigger?task=<task_name>"

.. note::

You need to explicitly enable the ``/metrics`` and ``/swagger`` endpoint while configuring your api.
You need to explicitly enable the ``/metrics`` endpoint while configuring your api.
Please see the example below for reference.

.. literalinclude:: ../code-samples/advanced/api/example.yaml
Expand Down
259 changes: 0 additions & 259 deletions pnp/api.py

This file was deleted.

Loading

0 comments on commit 1e1e830

Please sign in to comment.