Reactjs 结合React路由器和Firebase函数api
我想知道是否有一种方法可以同时使用react-router-dom和firebase函数。例如,React部分有一些链接,如mywebsite.com/pageone、mywebsite.com/pagetwo、mywebsite.com/pagetwo。我想添加一个来自firebase函数的mywebsite.com/api链接。我查阅了firebase文档,但它只显示执行其中一项或另一项操作。这可能吗?这是firebase.jsonReactjs 结合React路由器和Firebase函数api,reactjs,firebase,google-cloud-functions,react-router-dom,Reactjs,Firebase,Google Cloud Functions,React Router Dom,我想知道是否有一种方法可以同时使用react-router-dom和firebase函数。例如,React部分有一些链接,如mywebsite.com/pageone、mywebsite.com/pagetwo、mywebsite.com/pagetwo。我想添加一个来自firebase函数的mywebsite.com/api链接。我查阅了firebase文档,但它只显示执行其中一项或另一项操作。这可能吗?这是firebase.json { "hosting": { "public"
{
"hosting": {
"public": "build",
"ignore": ["firebase.json", "**/.*", "**/node_modules/**"],
"rewrites": [
{
"source": "**",
"destination": "/index.html"
},
{
"source": "/app/api",
"function": "app"
}
]
}
}
尝试更改重写的顺序,使通配符位于末尾。这为我解决了问题 发件人: 致:
"rewrites": [
{
"source": "**",
"destination": "/index.html"
},
{
"source": "/app/api",
"function": "app"
}
]
"rewrites": [
{
"source": "/app/api",
"function": "app"
},
{
"source": "**",
"destination": "/index.html"
}
]