【发布时间】:2020-12-03 16:15:39
【问题描述】:
我正在尝试使用 Firebase 托管来托管我的动态 Node.js 网站,但根据我的文件结构,我遇到了困难。如下所示:
在我的代码中,我没有使用 index.html 文件,但是当我运行 firebase init 时,它会自动为我创建一个 404.html 文件。当我部署我的代码时,似乎只有 index.html 文件在执行。但是当我删除 index.html 文件后尝试部署时,我可以看到 404.html 文件。
这是 firebase.json 文件。我正在使用:
{
"hosting": {
"public": "public",
"ignore": [
"firebase.json",
"**/.*",
"**/node_modules/**"
]
}
}
“public/html”文件夹中的所有文件似乎都没有执行。我尝试在 firebase.json 文件中将公共字段更改为 public/html,但是部署时我只能看到Cannot GET / 。与 'src/js' 文件夹中的 js 文件一起部署时,如何运行 'public/html' 文件夹中的文件?
我的代码中有一个 error.html 文件,它位于“public/html/main”下。如果我想在404.html文件之外使用它,我必须直接放在公共文件夹中吗?
此外,我还有很多后端文件。为了使用这些,我是否需要使用 firebase 提供的其他服务,或者可以通过使用 Firebase Hosting 本身来完成?
【问题讨论】: