mirror of
https://github.com/ClaytonWWilson/CS307-Team24.git
synced 2026-03-10 13:15:05 +00:00
Added functions Helloworld and getUsername for testing
This commit is contained in:
@@ -1,8 +1,22 @@
|
||||
const functions = require('firebase-functions');
|
||||
const admin = require('firebase-admin');
|
||||
|
||||
admin.initializeApp();
|
||||
// // Create and Deploy Your First Cloud Functions
|
||||
// // https://firebase.google.com/docs/functions/write-firebase-functions
|
||||
//
|
||||
// exports.helloWorld = functions.https.onRequest((request, response) => {
|
||||
// response.send("Hello from Firebase!");
|
||||
// });
|
||||
exports.helloWorld = functions.https.onRequest((request, response) => {
|
||||
response.send("Hello from Firebase!");
|
||||
});
|
||||
|
||||
exports.getUsername = functions.https.onRequest((req, res) => {
|
||||
admin.firestore().collection('users').get()
|
||||
.then(data => {
|
||||
let users = [];
|
||||
data.forEach(doc => {
|
||||
users.push(doc.data());
|
||||
})
|
||||
return res.json(users);
|
||||
})
|
||||
.catch((err) => console.error(err));
|
||||
})
|
||||
Reference in New Issue
Block a user