Cloud Functionsで外部APIで取得したデータをGCSに定期的に保存することをやったが、これをローカルで試したい uga-box.hatenablog.com
調べたらGCPチームがだしているこのライブラリがよさそう
インストールして
npm install @google-cloud/functions-framework
package.json内に目的の関数をオプションに渡して起動するscriptをつくって
"scripts": { "start": "functions-framework --target=helloWorld" }
サーバーを起動する
pm start ... Serving function... Function: helloWorld URL: http://localhost:8080/
あとはcurlなどでエンドポイントにリクスと送信すると結果が返ってくる
$ curl localhost:8080 # Output: Hello, World