firebase - 如何在本地测试firebase云功能express webserver更改
问题描述
我正在使用 Firebase 编写一个快速网络服务器。但是,似乎我无法在本地测试我的更改。
我正在尝试按照文档在本地测试云功能。但是当我在本地进行更改时,只会执行部署的版本,而不是本地版本。
在两个单独的外壳中,我正在运行:
firebase emulators:start --only functions
和
firebase serve --only hosting
这是/functions/index.js
const functions = require('firebase-functions');
const express = require('express');
const app = express();
const cors = require('cors')({origin: true});
app.use(cors);
app.get('/myroute', (req, res) => {
return res.send('hello1');
});
module.exports = {
app: functions.https.onRequest(app),
};
当我将 'hello1' 修改为 'hello2',然后保存,重新启动两个服务器,并localhost:5000/myroute
在我的浏览器中请求时,它仍然以hello1
.
当我请求时,如何让我的本地云功能更改出现localhost:5000/myroute
?
解决方案
推荐阅读
- python - 生成基于文本的直方图
- properties - Kotlin - 可空属性默认为空值
- java - 在 apache flink 中的 Flink 连接流中面临竞争条件
- javascript - 从后面的代码触发 JavaScript Confirm()
- java - 使用最少数量的矩形覆盖“曼哈顿天际线”
- tensorflow - 如何在张量流的 map_and_batch 的 map_func 中保存扭曲的图像?
- php - 用于从另一台服务器上的 Elasticsearch 获取数据的 PHP 脚本
- c# - 点燃瘦客户端自动重新连接不起作用
- php - PHP ssh2_exec 在空标准输出上没有 feof
- oracle - 如何创建以集合为属性的 Oracle 对象类型 以集合为属性的对象类型