This repo is helpful to start with if you want to use Google Cloud Functions. Specifically, the Functions Framework.
- A single file structure housing multiple functions
- A way to deploy all your functions with a single command
npm run deploy
- A way to run all your functions locally on a single port for easier development
Install the Google Cloud SDK if you don't already have it. Create a new project in console and enable Cloud Functions API for that project. Set your terminal to use that project.
npm install
npm start
Each file in /functions
is an endpoint. Feel free to create more, or less by:
- Duplicating one of those example files in
/functions
- Referencing that new file in your
index.js
To deploy all functions, run:
npm run deploy
Your functions will be accessible on Google Cloud Functions, at a URL such as:
https://us-central1-volt-oms-integration.cloudfunctions.net/helloWorld
Where us-central1
is the Google Cloud Region you picked and volt-oms-integration
is what you named your Google Cloud Project and helloWorld
is what you named your file in this project.