Sign Up for Free

RunKit +

Try any Node.js package right in your browser

This is a playground to test code. It runs a full Node.js environment and already has all of npm’s 400,000 packages pre-installed, including firebase-functions with all npm packages installed. Try it out:

require("firebase-admin/package.json"); // firebase-admin is a peer dependency. var firebaseFunctions = require("firebase-functions")

This service is provided by RunKit and is not affiliated with npm, Inc or the package authors.

firebase-functions v3.3.0

Firebase SDK for Cloud Functions

Firebase SDK for Cloud Functions

The firebase-functions package provides an SDK for defining Cloud Functions for Firebase.

Cloud Functions is a hosted, private, and scalable Node.js environment where you can run JavaScript code. The Firebase SDK for Cloud Functions integrates the Firebase platform by letting you write code that responds to events and invokes functionality exposed by other Firebase features.

Learn more

Learn more about the Firebase SDK for Cloud Functions in the Firebase documentation or check out our samples.

Here are some resources to get help:

  • Start with the quickstart: https://firebase.google.com/docs/functions/write-firebase-functions
  • Go through the guide: https://firebase.google.com/docs/functions/
  • Read the full API reference: https://firebase.google.com/docs/reference/functions/
  • Browse some examples: https://github.com/firebase/functions-samples

If the official documentation doesn't help, try asking through our official support channels: https://firebase.google.com/support/

Please avoid double posting across multiple channels!

Usage

// functions/index.js
const functions = require('firebase-functions');
const notifyUsers = require('./notify-users');

exports.newPost = functions.database
  .ref('/posts/{postId}')
  .onCreate((snapshot, context) => {
    console.log('Received new post with ID:', context.params.postId);
    return notifyUsers(snapshot.val());
  });

Contributing

To contribute a change, check out the contributing guide.

License

© Google, 2017. Licensed under The MIT License.

RunKit is a free, in-browser JavaScript dev environment for prototyping Node.js code, with every npm package installed. Sign up to share your code.
Sign Up for Free