Starter to develop and deploy APIs via Google Cloud Functions
Make sure to specify a CLOUD_PROJECT
in .env
. CLOUD_PROJECT
should be the name of an existing Google Cloud project.
# load environment variables from .env and .env.cloud
export $(cat .env | xargs)
# install and launch
npm install
npm run watch
Go to http://localhost:8080/
to interact with your API. Your code lives in index.js
. (The site will be reloaded whenever *.js
files change.)
Connect to your Cloud project:
gcloud config set project $CLOUD_PROJECT
Enable cloud functions for the current project:
gcloud services enable cloudfunctions.googleapis.com
Set the region to "Frankfurt":
gcloud config set functions/region europe-west3
To deploy, run:
npm run deploy