Browse Source

Update of the README to add details about the samples.

Change-Id: I304939b543efeae7e7130b24bf0611ad9c53d00e
ryanpbrewster-patch-1
Nicolas Garnier 8 years ago
parent
commit
b640a0e447
  1. 27
      README.md
  2. 16
      bigquery-import/functions/index.js
  3. 4
      fulltext-search/README.md

27
README.md

@ -16,43 +16,70 @@ This repository contains the following samples:
Demonstrates how to authorize with a 3rd party sign-in mechanism (LinkedIn in this case), create a Firebase custom auth token, update the user's profile and authorize Firebase.
Uses an HTTP trigger.
### [Authorize with Instagram](/instagram-auth)
Demonstrates how to authorize with a 3rd party sign-in mechanism (Instagram in this case), create a Firebase custom auth token, update the user's profile and authorize Firebase.
Uses an HTTP trigger.
### [Text Moderation](/text-moderation)
How to moderate user input text for bad words. For example this can be used to moderate usernames, chat or forum messages.
Uses an Realtime Database trigger.
### [Email Confirmation](/email-confirmation)
Sends email confirmation after users subscribed to a mailing list.
Uses an Realtime Database trigger.
### [LastModified Firebase Database tracking](/lastmodified-tracking)
Tracking when the Firebase Database (or a subset) was last modified.
Uses an Realtime Database trigger.
### [Webhook upon Database writes](/minimal-webhook)
Writing to the Database triggers a request to a callback URL (a Webhook). The content of the modified Data is sent to the Webhook.
Uses an Realtime Database trigger.
### [Firebase Database Child Nodes Count](/child-count)
Keeps track of the number of child nodes of a Firebase Database element allowing clients to filter or order results using the child count.
This can be useful to keep tack of the number of "likes" or "followers" of a somethings shares through social media.
Uses an Realtime Database trigger.
### [Automatic message translation](/message-translation)
Integrates the Google Translate API to perform automatic text translation across any number of languages. Language codes can be stored in Firebase for on the fly changes.
Uses an Realtime Database trigger.
### [Limit number of child nodes](/limit-children)
Make sure to keep the number of child nodes below a certain threshold. For instance this can be useful to limit the number of lines of logs or chat history below a given number.
Uses an Realtime Database trigger.
### [Import Data to Big Query](/bigquery-import)
Copies Firebase Database elements into BigQuery automatically. This can be useful for instance for further logs analysis.
Uses an Realtime Database trigger.
### [Full-text search via Algolia](/fulltext-search)
Enable full-text search on firebase database elements by using an Algolia hosted search service.
Uses an Realtime Database trigger.
## Contributing
We'd love that you contribute to the project. Before doing so please read our [Contributor guide](CONTRIBUTING.md).

16
bigquery-import/functions/index.js

@ -15,21 +15,21 @@
*/
'use strict';
var functions = require('firebase-functions');
var Q = require('q');
const functions = require('firebase-functions');
const Q = require('q');
// Authenticate to gcloud.
// TODO: Make sure you add your Google Project ID, Private key and Email into the env.json file.
var gcloudconfig = {
const gcloudconfig = {
projectId: functions.env.get('google.project_id'),
credentials: require('./service-accounts.json')
};
var gcloud = require('gcloud')(gcloudconfig);
var bigquery = gcloud.bigquery();
const gcloud = require('gcloud')(gcloudconfig);
const bigquery = gcloud.bigquery();
// TODO: Change <YOUR-DATASET-NAME> with your BigQuery dataset name.
var dataset = bigquery.dataset('<YOUR-DATASET-NAME>');
const dataset = bigquery.dataset('<YOUR-DATASET-NAME>');
// TODO: Change <YOUR-TABLE-NAME> with your BigQuery table name.
var table = dataset.table('<YOUR-TABLE-NAME>');
const table = dataset.table('<YOUR-TABLE-NAME>');
/**
* Writes all logs from the Realtime Database into bigquery.
@ -40,7 +40,7 @@ exports.addtobigquery = functions.database().path('/logs/$logid').on('value', ev
ID: event.data.key(),
MESSAGE: event.data.val().message,
NUMBER: event.data.val().number
}, function(err, insertErr) {
}, (err, insertErr) => {
if (err) {
console.log(err);
result.reject(err);

4
fulltext-search/README.md

@ -37,3 +37,7 @@ To perform new searches clients add the search query to the realtime database un
Firebase function which performs the search on the Algolia instance. The results are written under the /search/results
tree.
## Setting up the sample
- Create an Algolia account at [www.algolia.com](https://www.algolia.com/)
- Set your Algolia Key and Secret in the `env.json` file.

Loading…
Cancel
Save