firebase 服务后如何访问功能

How can I access to functions after firebase serve

我正在使用 firebase 在我的机器上进行测试。 firebase serve 之后 我只能使用 HTTP 访问功能: http://localhost:5001/project/us-central1/endpoint

但是,当我尝试获取参数时。

export const basicHTTP = functions.https.onRequest((req, res) => {
  const name = req.params.name
  res.send(`Hi, good! ${name}`)
})

我无法检索任何参数。我想我必须以 https 访问我的本地主机。

但是我的本地环境没有提供通过SSL访问的方式。 我该如何处理?

模拟器使 HTTPS 云函数在本地主机上的 HTTPS HTTP 上可用。因此,您可以通过代码在 HTTP 上调用它。

来自 connecting to HTTPS functions in the emulator 上的文档:

Each HTTPS function in your code will be served from the local emulator using the following URL format:

http://$HOST:$PORT/$PROJECT/$REGION/$NAME

For example a simple helloWorld function with the default host port and region would be served at:

https://localhost:5001/$PROJECT/us-central1/helloWorld