【问题标题】:Google Function - How to handle multiple resource path In PythonGoogle Function - 如何在 Python 中处理多个资源路径
【发布时间】:2022-01-22 08:42:00
【问题描述】:

我正在尝试使用google functions 创建一个小型休息服务器。有人可以告诉我如何处理多个资源路径吗?

目前我正在做以下方式。

def func_handler(request):
    print(request.path)
    if request.path == "/":
        return handle_root_path(request)

    if request.path == "/test":
        return handle_test_path(request)

由于google函数在python下面使用flask,我有什么办法可以使用@app.route装饰器来处理它?

【问题讨论】:

  • 下面的答案是否解决了您的问题?如果是这样,请考虑对其进行投票,以便社区会发现答案很有帮助。

标签: python google-cloud-functions


【解决方案1】:

wrote an article 对此。看看并从中汲取灵感!

请记住,这不是一个好主意。更喜欢 Cloud Run。

【讨论】:

  • 是的,我偶然发现了那篇文章。
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2021-09-18
  • 1970-01-01
  • 2019-10-02
  • 1970-01-01
  • 2018-03-30
  • 1970-01-01
相关资源
最近更新 更多