Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/firebase/6.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Node.js 使用Firebase函数使用.listen()_Node.js_Firebase_Express_Google Cloud Functions - Fatal编程技术网

Node.js 使用Firebase函数使用.listen()

Node.js 使用Firebase函数使用.listen(),node.js,firebase,express,google-cloud-functions,Node.js,Firebase,Express,Google Cloud Functions,我刚刚进入Express,使用云功能进行操作,我遇到了一个问题。我知道在本地计算机上运行时,我可以使用: app.listen(port1, hostname, () => console.log(`Express Server running at http://${hostname}:${port1}/`)); 上面的代码基于Express的文档,说明它创建了一个http.createServer对象,就像使用Vanilla Node.js一样 但我的问题是,由于Firebase是无

我刚刚进入Express,使用云功能进行操作,我遇到了一个问题。我知道在本地计算机上运行时,我可以使用:

app.listen(port1, hostname, () => console.log(`Express Server running at http://${hostname}:${port1}/`));
上面的代码基于Express的文档,说明它创建了一个http.createServer对象,就像使用Vanilla Node.js一样

但我的问题是,由于Firebase是无服务器的,并且为您提供了专用IP,我可以使用
端口
和或
主机名
选项吗

我想,导航到
mysite.com:1234/example_path
或侦听来自无服务器平台的特定端口的请求会很好


如果没有,这些值的设置有什么作用?从这里开始,如果我不手动设置它们,默认值是什么?我可以将脚本设置为默认监听吗?

您没有使用云功能的专用IP地址。项目功能的解析IP地址可能会随时间而更改。在云函数的控制下,您的函数可能同时在多个服务器实例上运行

您无法在云函数中的某些端口上侦听。对于HTTP类型的函数,云函数为您管理侦听,您只需处理传入的请求


若你们想写HTTP函数,你们应该从。

开始。当然,我喜欢无服务器的基础设施,只是想限制一下。我现在正试图证明使用Express的合理性。