Do Google Cloud Platform HTTP Functions Support Route Parameters?

后端 未结 4 1810
野性不改
野性不改 2021-02-20 16:25

This is a bit simpler a question than I tend to like to come here with but I\'ve been driving myself up the wall trying to find an answer to this and I absolutely cannot-

<
4条回答
  •  粉色の甜心
    2021-02-20 16:57

    If you don't want to pass data in the body, you can always put it into a query parameter of the url. Like:

    http://yourGoogleProject.cloudfunctions.net/users?userid={userId}&bookId={bookid}
    

    And in the cloud function you simply access the query parameter from the req object, like:

    exports.users = (req, res) => {
      res.status(200).send(`Hello from user:  + $(req.query.userid) your bookId: $(req.query.bookid)`);
      }
    

提交回复
热议问题