如何从Firebasefunction访问Firebase托pipe文件

我有一个简单的firebase函数,它必须发送一个文件来响应文件在/app/one.html中的请求

我的项目目录结构

blog |____app |____index.html |____one.html |____functions |____index.js 

我必须访问one.html并从senFile()发送它

index.js

 const functions = require('firebase-functions'); exports.blog = functions.https.onRequest((req, res) => { res.status(200).sendFile('app/one.html'); #here I need something to do }); 

据我所知, firebase deployfunction只部署function文件夹的内容。 所以,如果你移动/复制你的应用程序文件夹到函数文件夹内,你可以实现你正在做的事情。

 blog |____functions |____app |____index.html |____one.html |____index.js 

正确地更改path之后,您可以像快速应用程序一样发送文件。

 res.sendFile(path.join(__dirname + 'app/one.html'));