# Deploy a public HTTP function (no authentication)
gcloud functions deploy getHelloWorld \
--gen2 \
--runtime nodejs20 \
--trigger-http \
--region $REGION \
--allow-unauthenticated \
--source="./functions/getHelloWorld" \
--entry-point="getHelloWorld" \
--project="$PROJECT_ID"
# Deploy a private HTTP function (requires authentication)
gcloud functions deploy getUserData \
--gen2 \
--runtime nodejs20 \
--trigger-http \
--region $REGION \
--no-allow-unauthenticated \
--source="./functions/getUserData" \
--entry-point="getUserData" \
--project="$PROJECT_ID"
Note: After deployment, you'll get URLs like:
https://$REGION-$PROJECT_ID.cloudfunctions.net/getHelloWorld
https://$REGION-$PROJECT_ID.cloudfunctions.net/getUserData