`functions.https.onRequest((req, res)...` における `req` から、リクエストパラメタを取得する方法のメモ。
query
GETリクエストのクエリパラメタを取得する。
例: `curl -X GET -H “Content-Type: application/json” https://us-central1-<project-id>.cloudfunctions.net/someFunc?key1=value1`
req.query.key1 → value1
body
POSTリクエストのリクエストパラメタを取得する。
例: curl -X POST -H “Content-Type: application/json” -d ‘{“key2”:”value2”}’ https://us-central1-<project-id>.cloudfunctions.net/someFunc
req.body.key2 → value2
参考
- [HTTP リクエスト経由で関数を呼び出す](https://firebase.google.com/docs/functions/http-events)
- [“providers/https” | Firebase Functions SDK](https://firebase.google.com/docs/reference/functions/providers_https_#onrequest)
- [Express 4.x — API Reference](https://expressjs.com/en/api.html#req.query)