A Python FastAPI template that make use of the incubator project of-watchdog.
Templates available in this repository:
- python3-fastapi
$ faas template pull https://github.com/loudsquelch/openfaas-python3-fastapi-template
Create a new function
$ faas new --lang python3-fastapi <fn-name>
Build, push, and deploy
$ faas up -f <fn-name>.yml
Set your OpenFaaS gateway URL. For example:
$ OPENFAAS_URL=http://127.0.0.1:8080
Test the new function
$ curl -i $OPENFAAS_URL/function/<fn-name>
The function handler is passed one argument - req which contains the request body.
By default, the template will automatically attempt to set the correct Content-Type header for you based on the type of response.