functions.https.onRequestのquery/body

p0dee
Jan 26, 2021

--

`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

参考

Sign up to discover human stories that deepen your understanding of the world.

Free

Distraction-free reading. No ads.

Organize your knowledge with lists and highlights.

Tell your story. Find your audience.

Membership

Read member-only stories

Support writers you read most

Earn money for your writing

Listen to audio narrations

Read offline with the Medium app

--

--

No responses yet

Write a response