Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- const functions = require('firebase-functions');
- const admin = require('firebase-admin');
- admin.initializeApp();
- const language = require('@google-cloud/language');
- const client = new language.LanguageServiceClient();
- const express = require('express');
- const app = express();
- app.post('/calculateAverage', async (request, response) => {
- const bodyUserId = request.body.id
- let query = admin.database().ref(`/user_info/`);
- try {
- const snapshot = await query.once('value');
- snapshot.forEach((childSnapshot) => {
- console.log("key: " + childSnapshot.key + " value: " + childSnapshot.val())
- });
- response.send({"snapshot await": "ok"});
- } catch(error) {
- console.log('Error getting messages', error.message);
- response.send({"snapshot await error": error.message});
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement