【发布时间】:2019-02-21 08:18:07
【问题描述】:
我目前正在使用 Firebase Cloud Functions 解决方案开发服务器端渲染应用程序
为了实现这一点,我想在根 url 插入一个 express 实例(用于自定义路由)
我想用一个简单的 /<function> (/helloWordl) 重写它而不是 /<project>/<zone>/<function>(例如:/test/us-central1/helloWorld)网址
为了实现这一点,我尝试取消 url 重写 Firebase Hosting 的功能:
{
"hosting": {
"rewrites": [
{
"source": "**",
"function": "helloWorld"
}
]
}
}
但是现在,当我运行 firebase serve 时,我的本地服务器在我尝试的每个 url 上都会显示 404 错误
【问题讨论】:
-
你有没有实现 helloWorld 函数来处理请求?
-
是的,这是默认的注释路由(当您使用 fireabse-tools 设置功能时)
-
请在此处查看我的回答:stackoverflow.com/a/54096387/4516797希望对您有所帮助
标签: firebase google-cloud-functions firebase-hosting