Execução de uma função na nuvem do google.
Código em Python
Exemplo de arquivo main.py
:
import functions_framework
@functions_framework.http
def hello_http(request):
"""HTTP Cloud Function.
Args:
request (flask.Request): The request object.
<https://flask.palletsprojects.com/en/1.1.x/api/#incoming-request-data>
Returns:
The response text, or any set of values that can be turned into a
Response object using `make_response`
<https://flask.palletsprojects.com/en/1.1.x/api/#flask.make_response>.
"""
# Log that the file was written to the bucket
return 'Works!'
Exemplo de arquivo requirements.txt
:
functions-framework==3.*
Para subir um server de desenvolvimento:
$ functions-framework --target hello_http --debug
Em seguida, acesse direto: http://localhost:8080
Mais docs sobre functions-framework