functions framework
Functions Framework  |  Google Cloud Functions に関するドキュメント
local開発
リクエストのタイプ(http, cloudEvents, pubsub...?) に応じた関数の呼び出し
serveless frameworkとの違いは?
単に Google Cloud に特化してるということ?
各ランタイムでeventベースのライブラリ?をwrapしたようなもの?
pythonではflask, NodeJSではexpress, goは単に? httpハンドラ?
https://gyazo.com/e3615416655eca90b049841d7fcd7838
https://www.youtube.com/watch?v=yMEcyAkTliU&t=912s
NodeJS
GoogleCloudPlatform/functions-framework-nodejs: FaaS (Function as a service) framework for writing portable Node.js functions
Node.jsのものは、Node.js Expressが入ってる。
runtimeは、pythonや他の言語もある。
Google Cloud, Firebaseのアカウント設定抜きで始められる
例: npx @google-cloud/functions-framework --target=helloWorld --port=8083
気軽にweb serverまで建てられるけど、reload, hot reloadはできない。
ctrl+cでkillできない....
deployするには、GCP側の設定は必要
expressの設定まで面倒を見てくれる。cloud functionsがそうだけど、localでも..
lifecycle
関数名を pathとしてexposeしてくれる
req, res を expressに合わせてくれる
res.send('hoge')
event baseのtriggerにも対応する。
cloud functions, local, knative(cloud run, cloud run on GKE)
knativeにdeplotする場合は、containerを自分でmanageする
Dockerfileを書いて、cloudbuild.yamlを書く。
参考:
GCP Cloud Functions と Cloud Firestore を用いたサーバーレスアプリケーションの構築 | GMOインターネットグループ 次世代システム研究室
Functions FrameworkでTypeScriptを使いつつCloud Functionsにデプロイする - Qiita
TypeScriptでやる場合の細かな修正点を解説してくれてる。
#Google_Cloud_Functions