How to deploy node.js functions to Google Cloud.

Get started with Node & GCP

Initializing gcloud

Enabling Google Cloud Functions API

Creating a basic http functions

$ npm init -y
exports.myFunction = (req, res) => {
res.send(`<h1>You're awesome 🤘</h1>`);

Testing with the functions emulator

$ npm install -g @google-cloud/functions-emulator
functions deploy myFunction --trigger-http

Deploying to Google Cloud

$ gcloud functions deploy myFunction --trigger-http --runtime=nodejs8

Other types of functions

I write about JavaScript, Reverse Engineering, Security, and Credential Stuffing. Also a speaker, O'Reilly Author, creator of Plato, Director at Shape Security.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store