如何在本地测试firebase云函数express Web服务器更改

如何在本地测试firebase云函数express Web服务器更改,firebase,google-cloud-functions,firebase-cli,Firebase,Google Cloud Functions,Firebase Cli,我正在使用Firebase编写一个express Web服务器。然而,我似乎无法在本地测试我的更改 我正试图遵循本地测试云功能的方法。但是,当我在本地进行更改时,只会执行已部署的版本,而不会执行本地版本 在两个独立的shell中,我运行: firebase仿真器:启动--仅限函数 和 firebase服务--仅托管 这里是/functions/index.js const functions = require('firebase-functions'); const express = req

我正在使用Firebase编写一个express Web服务器。然而,我似乎无法在本地测试我的更改

我正试图遵循本地测试云功能的方法。但是,当我在本地进行更改时,只会执行已部署的版本,而不会执行本地版本

在两个独立的shell中,我运行:

firebase仿真器:启动--仅限函数
firebase服务--仅托管

这里是
/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
时,如何使我的本地云功能更改显示?

“只执行部署的版本,而不是本地版本”-这对我来说没有意义,因为您在这里描述的内容没有运行
firebase deploy
命令。如果您没有实际部署新代码,那么您部署的版本如何更改?我在这个问题上不够清楚。在创建返回“hello1”的
myroute
之后,我运行了
firebase部署
。然后我将
myroute
更改为返回“hello2”,并运行本地模拟器和服务器,访问了
localhost:5000/myroute
,但它仍然返回“hello1”。我希望
localhost:5000/myroute
返回'hello2'“只执行部署的版本,而不是本地版本”-这对我来说没有意义,因为您在这里描述的内容没有运行
firebase deploy
命令。如果您没有实际部署新代码,那么您部署的版本如何更改?我在这个问题上不够清楚。在创建返回“hello1”的
myroute
之后,我运行了
firebase部署
。然后我将
myroute
更改为返回“hello2”,并运行本地模拟器和服务器,访问了
localhost:5000/myroute
,但它仍然返回“hello1”。我希望
localhost:5000/myroute
返回'hello2'