mirror of
https://github.com/ClaytonWWilson/CS307-Team24.git
synced 2025-12-16 10:18:48 +00:00
34 lines
1.2 KiB
JavaScript
34 lines
1.2 KiB
JavaScript
/* eslint-disable promise/always-return */
|
|
const functions = require('firebase-functions');
|
|
const app = require('express')();
|
|
const cors = require('cors');
|
|
app.use(cors());
|
|
|
|
const FBAuth = require('./util/FBAuth');
|
|
|
|
/*------------------------------------------------------------------*
|
|
* handlers/users.js *
|
|
*------------------------------------------------------------------*/
|
|
const {getUserDetails, getProfileInfo, updateProfileInfo} = require('./handlers/users');
|
|
|
|
// Returns all data in the users collection
|
|
app.get('/getUser/:handle', getUserDetails);
|
|
|
|
// Returns all profile data of the currently logged in user
|
|
// TODO: Add FBAuth
|
|
app.get('/getProfileInfo', getProfileInfo);
|
|
|
|
// Updates the currently logged in user's profile information
|
|
// TODO: Add FBAuth
|
|
app.post('/updateProfileInfo', updateProfileInfo);
|
|
|
|
/*------------------------------------------------------------------*
|
|
* handlers/post.js *
|
|
*------------------------------------------------------------------*/
|
|
const {putPost} = require('./handlers/post');
|
|
|
|
// Adds one post to the database
|
|
app.post('/putPost', FBAuth, putPost);
|
|
|
|
|
|
exports.api = functions.https.onRequest(app); |