- Get you started quickly with
Google Cloud Functions
- Has provision for a basic middleware (like auth and cors)
- Uses
@google-cloud/functions-framework
for local development - Includes deployment script
deploy-to-cloud.sh
- Clone this template project
- Rename and go inside
- On your terminal, run this command:
npm install
- Then run this command:
npm run dev
- That's all! It should be running at
http://localhost:8081/
- Edit file
deploy-to-cloud.sh
- Replace
<function-name>
with actual name of the cloud function, for example:image-resizer
- Replace
<gcp-project-name>
with actual name of the gcp project - Replace
<gcp-region>
with actual name of the gcp region - Setup Gcloud SDK into your terminal, Gcloud SDK
- On your terminal, Run
./deploy-to-cloud.sh
- Edit file
deploy-to-cloud.sh
- Replace
<function-name>
with actual name of the cloud function, for example:image-resizer
- Replace
<gcp-project-name>
with actual name of the gcp project - Replace
<gcp-region>
with actual name of the gcp region - Moment you commit your code to
master
branch of your repository, build pipeline will start and the Google cloud function will be deployed automatically. - Wait for a couple of minutes, the project should be deployed to Google cloud functions
- Check whether it's running properly at the console