Building and testing locally

As the Cloud Functions run on a Node.js environment, we can build and test our application locally just using a Node.js emulator with development tools. The emulator is an open source and code is hosted on the GitHub. Let's look at how to use it:

  1. Install the emulator through npm or Yarn; you need to make sure you have Node.js installed on your machine:
$ npm install -g @google-cloud/functions-emulator/usr/local/bin/functions-emulator -> /usr/local/lib/node_modules/@google-cloud/functions-emulator/bin/functions /usr/local/bin/functions -> /usr/local/lib/node_modules/@google-cloud/functions-emulator/bin/functions> @google-cloud/functions-emulator@1.0.0-beta.4 postinstall /usr/local/lib/node_modules/@google-cloud/functions-emulator ...

Get DevOps for Serverless Applications now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.