ler*_*ros 3 firebase firebase-hosting
我已经看到其他堆栈溢出答案,使用 Firebase 重写将 /api/** 路由到其 Express 应用程序功能。
我正在遵循这些说明,但也尝试托管单页应用程序。
将两者结合起来似乎不起作用,因为 API 路由仍然映射到我的 index.html 文件。
这些是我的重写
"rewrites": [
{
"source": "/api/**",
"function": "api"
},
{
"source": "**",
"destination": "/index.html"
}
]
Run Code Online (Sandbox Code Playgroud)
这可能吗?
为了回答您的问题,我设法通过从单页应用程序规则中排除 /api/ 来做到这一点。
"rewrites": [
{
"source": "/api/**",
"function": "api"
},
{
"source": "!/api/**",
"destination": "/index.html"
}
]
Run Code Online (Sandbox Code Playgroud)
在这里我们说:
| 归档时间: |
|
| 查看次数: |
440 次 |
| 最近记录: |