mirror of
https://github.com/ClaytonWWilson/CS307-Team24.git
synced 2025-12-16 02:08:47 +00:00
22 lines
674 B
JavaScript
22 lines
674 B
JavaScript
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.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));
|
|
}) |