html - 我无法从 Firebase 函数加载公用文件夹中的 html 文件
问题描述
我知道路径目录是正确的路径,只是我总是得到错误'Error: ENOENT: no such file or directory, stat '/public/resetp.html'
我的路径如下:
index.js: firebase/functions/index.js
reset password.html: firebase/public/resetp.html
当我在我的网站上的函数上访问此端点时,它会运行以下代码:
response.sendFile(path.join(__dirname, '/./public/resetp.html'));
我需要使用 sendFile() 函数,以便只呈现 html 文件而不更改 URL,因为在我尝试加载的 html 文件中,它获取 URL 的参数(如操作代码)和获取用户输入以重置用户密码。
谢谢,内森
解决方案
您可以通过在public
目录中创建目录来实现此目的functions
:
{
"hosting": {"public": "functions/public"}
}
您functions
目录中的所有文件都使用 Cloud Functions 部署,并且没有可用的文件之外的文件。
警告:可用的文件将是部署 Cloud Functions 时公共目录中的任何文件。您可以确保托管和功能部署保持同步。
推荐阅读
- javascript - 添加、删除或编辑行后如何保存我在 html 表中所做的更改
- iis - IIS,新站点绑定拒绝 Windows 凭据
- python - Python websocket - 如何让一些数据流动?
- r - 如何使低于阈值的所有值都具有单色且比例连续?
- python - 如何快速子集许多数据帧?
- glib - 如何正确处理 GLib 中的浮动引用参数?
- javascript - 如果我是被记录的 abd 刷新页面,我将在主页上重定向
- python - 将 pandas 数据帧与 one-hot 编码编码进行比较
- google-sheets - 使用按月排序的数据验证下拉菜单构建仪表板
- javascript - 如何将多个输入文本值传递给控制器中的方法