/ts-express-cloud-function-template

Template for a express powered GCP cloud function in TypeScript, deployed with Circle CI

Primary LanguageTypeScriptMIT LicenseMIT

ts-express-cloud-function-template

Project template for spinning up express powered cloud functions written in TypeScript and deployed via circleci.

Pre-reqs

Getting started

  • Clone the repository
git clone --depth=1 https://github.com/StefanKjartansson/ts-express-cloud-function-template.git <project_name>
  • Install dependencies
cd <project_name>
yarn install
  • Update package.json with <project_name> and related information.
  • Write code

Configuring services & deployment pipeline

  • In GCP, enable cloud functions for your project
  • Export service account key with cloud function developer permissions
  • Configure project in circleci and add the following environment variables:
GCP_AUTH=Value should be base64 encoded service account key "base64 <your-service-account.json>"
GCP_PROJECT=Your project id from GCP.
GCP_FUNCTION=The name of the function in GCP.
  • Push change and circle should deploy your function.
  • When calling your function, remember to append a slash to the path