Quantcast
Channel: Node.jsタグが付けられた新着記事 - Qiita
Viewing all articles
Browse latest Browse all 9146

Google Cloud Functions: 加算

$
0
0
sum_up.js /** * Responds to any HTTP request. * * @param {!express:Request} req HTTP request context. * @param {!express:Response} res HTTP response context. */ exports.sum_up = (req, res) => { var str_out = "" str_out += "これはテストです。\n" str_out += "Good Evening\n" str_out += "今晩は\n" str_out += "Apr/04/2022 PM 18:02\n" const aa = req.body['aa'] const bb = req.body['bb'] const sum = parseInt(aa) + parseInt(bb) str_out += "aa = " + aa + "\n" str_out += "bb = " + bb + "\n" str_out += "sum = " + sum + "\n" res.send(str_out) }; curl のテストスクリプト curl_post.sh HOST="https://asia-northeast1-my-project-aug-29-2016.cloudfunctions.net" # curl $HOST"/test-function-uchida-apr04" \ -H "Authorization: bearer $(gcloud auth print-identity-token)" \ -d 'aa=12&bb=45' echo "" Httpie のテストスクリプト httpie_post.sh HOST="https://asia-northeast1-my-project-aug-29-2016.cloudfunctions.net" # http $HOST"/test-function-uchida-apr04" \ "Authorization: bearer $(gcloud auth print-identity-token)" \ aa=19 bb=35

Viewing all articles
Browse latest Browse all 9146

Trending Articles