我创建了一个函数,当我在Firebase.json中包含该函数后构建项目时,我收到一个错误。
{
"hosting": {
"public": "dist",
"ignore": [
"firebase.json",
"**/.*",
"**/node_modules/**"
],
"rewrites": [
{
"source": "**",
"destination": "/index.html",
"function": "app"
}
]
}
}
你的nodejs文件需要一个get路由,它将用作其余方法的入口点。
"source: "**"
需要实际路线。
对于我使用初始化的应用程序
app.get('/init',function(req, res){
app.listen(process.env.PORT || 8080, () => console.log(__dirname));
})
因此我的来源需要
"source: "/init"
欲了解更多信息,请查看: https://www.youtube.com/watch?v=LOeioOKUKI8
我在重写部分中删除了目标,它起作用了。我不确定我是否缺少任何其他内容来让请求通过函数传递